library(tidyverse)
library(car)
library(modelr)
library(skimr)
library(GGally)
library(ggfortify)

Question 1

Tidy up the data ready for regression:

house <- read_csv("data/kc_house_data.csv") %>% janitor::clean_names()
Rows: 21613 Columns: 21
── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr   (1): id
dbl  (19): price, bedrooms, bathrooms, sqft_living, sqft_lot, floors, waterfront, view, condition, grade, sqft_above, sqft_basement, y...
dttm  (1): date

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
summary(house)
      id                 date                            price            bedrooms        bathrooms      sqft_living       sqft_lot      
 Length:21613       Min.   :2014-05-02 00:00:00.00   Min.   :  75000   Min.   : 0.000   Min.   :0.000   Min.   :  290   Min.   :    520  
 Class :character   1st Qu.:2014-07-22 00:00:00.00   1st Qu.: 321950   1st Qu.: 3.000   1st Qu.:1.750   1st Qu.: 1427   1st Qu.:   5040  
 Mode  :character   Median :2014-10-16 00:00:00.00   Median : 450000   Median : 3.000   Median :2.250   Median : 1910   Median :   7618  
                    Mean   :2014-10-29 04:38:01.96   Mean   : 540088   Mean   : 3.371   Mean   :2.115   Mean   : 2080   Mean   :  15107  
                    3rd Qu.:2015-02-17 00:00:00.00   3rd Qu.: 645000   3rd Qu.: 4.000   3rd Qu.:2.500   3rd Qu.: 2550   3rd Qu.:  10688  
                    Max.   :2015-05-27 00:00:00.00   Max.   :7700000   Max.   :33.000   Max.   :8.000   Max.   :13540   Max.   :1651359  
     floors        waterfront            view          condition         grade          sqft_above   sqft_basement       yr_built   
 Min.   :1.000   Min.   :0.000000   Min.   :0.0000   Min.   :1.000   Min.   : 1.000   Min.   : 290   Min.   :   0.0   Min.   :1900  
 1st Qu.:1.000   1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.:3.000   1st Qu.: 7.000   1st Qu.:1190   1st Qu.:   0.0   1st Qu.:1951  
 Median :1.500   Median :0.000000   Median :0.0000   Median :3.000   Median : 7.000   Median :1560   Median :   0.0   Median :1975  
 Mean   :1.494   Mean   :0.007542   Mean   :0.2343   Mean   :3.409   Mean   : 7.657   Mean   :1788   Mean   : 291.5   Mean   :1971  
 3rd Qu.:2.000   3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:4.000   3rd Qu.: 8.000   3rd Qu.:2210   3rd Qu.: 560.0   3rd Qu.:1997  
 Max.   :3.500   Max.   :1.000000   Max.   :4.0000   Max.   :5.000   Max.   :13.000   Max.   :9410   Max.   :4820.0   Max.   :2015  
  yr_renovated       zipcode           lat             long        sqft_living15    sqft_lot15    
 Min.   :   0.0   Min.   :98001   Min.   :47.16   Min.   :-122.5   Min.   : 399   Min.   :   651  
 1st Qu.:   0.0   1st Qu.:98033   1st Qu.:47.47   1st Qu.:-122.3   1st Qu.:1490   1st Qu.:  5100  
 Median :   0.0   Median :98065   Median :47.57   Median :-122.2   Median :1840   Median :  7620  
 Mean   :  84.4   Mean   :98078   Mean   :47.56   Mean   :-122.2   Mean   :1987   Mean   : 12768  
 3rd Qu.:   0.0   3rd Qu.:98118   3rd Qu.:47.68   3rd Qu.:-122.1   3rd Qu.:2360   3rd Qu.: 10083  
 Max.   :2015.0   Max.   :98199   Max.   :47.78   Max.   :-121.3   Max.   :6210   Max.   :871200  
skim(house)
── Data Summary ────────────────────────
                           Values
Name                       house 
Number of rows             21613 
Number of columns          21    
_______________________          
Column type frequency:           
  character                1     
  numeric                  19    
  POSIXct                  1     
________________________         
Group variables            None  

remove unwanted columns

house <- house %>% 
  select(-c(date, id, sqft_living15, sqft_lot15, zipcode))

change waterfront and yr_renovated into logical columns

house <- house %>% 
  mutate(waterfront = as.logical(waterfront),
         yr_renovated = if_else(yr_renovated > 0, TRUE, FALSE))

convert view, condition and grade to ordinal type

view_level <- house %>% 
  distinct(view) %>%
  arrange(view) %>% 
  pull()

condition_level <- house %>% 
  distinct(condition) %>% 
  arrange(condition) %>% 
  pull()

grade_level <- house %>% 
  distinct(grade) %>% 
  arrange(grade) %>% 
  pull()

house <- house %>% 
  mutate(view = factor(view, levels = view_level, ordered = TRUE),
         condition = factor(condition, levels = condition_level, ordered = TRUE),
         grade = factor(grade, levels = grade_level, ordered = TRUE))
skim(house)
── Data Summary ────────────────────────
                           Values
Name                       house 
Number of rows             21613 
Number of columns          16    
_______________________          
Column type frequency:           
  factor                   3     
  logical                  2     
  numeric                  11    
________________________         
Group variables            None  
house %>% 
  count(view)

house %>% 
  count(condition)

house %>% 
  count(grade)

Question 2

Check for aliased variables using the alias() function (this takes in a formula object and a data set).

check for alias using alias

alias(lm(price ~ .,
         data = house))
Model :
price ~ bedrooms + bathrooms + sqft_living + sqft_lot + floors + 
    waterfront + view + condition + grade + sqft_above + sqft_basement + 
    yr_built + yr_renovated + lat + long

Complete :
              (Intercept) bedrooms bathrooms sqft_living sqft_lot floors waterfrontTRUE view.L view.Q view.C view^4 condition.L
sqft_basement  0           0        0         1           0        0      0              0      0      0      0      0         
              condition.Q condition.C condition^4 grade.L grade.Q grade.C grade^4 grade^5 grade^6 grade^7 grade^8 grade^9 grade^10
sqft_basement  0           0           0           0       0       0       0       0       0       0       0       0       0      
              grade^11 sqft_above yr_built yr_renovatedTRUE lat long
sqft_basement  0       -1          0        0                0   0  

remove aliased variable from the data and check again for aliases

house <- house %>% 
  select(- sqft_basement)

alias(lm(price ~ .,
         data = house))
Model :
price ~ bedrooms + bathrooms + sqft_living + sqft_lot + floors + 
    waterfront + view + condition + grade + sqft_above + yr_built + 
    yr_renovated + lat + long

Question 3

Systematically build a regression model containing up to four main effects (remember, a main effect is just a single predictor with coefficient), testing the regression diagnostics as you go * splitting datasets into numeric and non-numeric columns might help ggpairs() run in manageable time, although you will need to add either a price or resid column to the non-numeric dataframe in order to see its correlations with the non-numeric predictors.

select all numeric types

house_numeric <- house %>% 
  select_if(is.numeric)

select all non-numeric types

house_nonnumeric <- house %>% 
  select_if(function(x) !is.numeric(x))

add in price column from house data

house_nonnumeric$price <- house$price

add ln_price in all data sets

house <- house %>% 
  mutate(ln_price = log(price))

house_numeric <- house_numeric %>% 
  mutate(ln_price = log(price))

house_nonnumeric <- house_nonnumeric %>% 
  mutate(ln_price = log(price))

ggpair the numeric data

house_numeric %>%
  select(price, everything()) %>% 
  ggpairs()

 plot: [1,1] [>-----------------------------------------------------------------------------------------------------------]  1% est: 0s 
 plot: [1,2] [=>----------------------------------------------------------------------------------------------------------]  2% est: 4s 
 plot: [1,3] [==>---------------------------------------------------------------------------------------------------------]  2% est: 5s 
 plot: [1,4] [===>--------------------------------------------------------------------------------------------------------]  3% est: 5s 
 plot: [1,5] [===>--------------------------------------------------------------------------------------------------------]  4% est: 5s 
 plot: [1,6] [====>-------------------------------------------------------------------------------------------------------]  5% est: 5s 
 plot: [1,7] [=====>------------------------------------------------------------------------------------------------------]  6% est: 5s 
 plot: [1,8] [======>-----------------------------------------------------------------------------------------------------]  7% est: 5s 
 plot: [1,9] [=======>----------------------------------------------------------------------------------------------------]  7% est: 6s 
 plot: [1,10] [========>--------------------------------------------------------------------------------------------------]  8% est: 6s 
 plot: [1,11] [=========>-------------------------------------------------------------------------------------------------]  9% est: 6s 
 plot: [2,1] [==========>-------------------------------------------------------------------------------------------------] 10% est: 6s 
 plot: [2,2] [===========>------------------------------------------------------------------------------------------------] 11% est: 6s 
 plot: [2,3] [===========>------------------------------------------------------------------------------------------------] 12% est: 6s 
 plot: [2,4] [============>-----------------------------------------------------------------------------------------------] 12% est: 6s 
 plot: [2,5] [=============>----------------------------------------------------------------------------------------------] 13% est: 6s 
 plot: [2,6] [==============>---------------------------------------------------------------------------------------------] 14% est: 6s 
 plot: [2,7] [===============>--------------------------------------------------------------------------------------------] 15% est: 6s 
 plot: [2,8] [================>-------------------------------------------------------------------------------------------] 16% est: 6s 
 plot: [2,9] [=================>------------------------------------------------------------------------------------------] 17% est: 6s 
 plot: [2,10] [==================>----------------------------------------------------------------------------------------] 17% est: 5s 
 plot: [2,11] [==================>----------------------------------------------------------------------------------------] 18% est: 5s 
 plot: [3,1] [====================>---------------------------------------------------------------------------------------] 19% est: 5s 
 plot: [3,2] [====================>---------------------------------------------------------------------------------------] 20% est: 5s 
 plot: [3,3] [=====================>--------------------------------------------------------------------------------------] 21% est: 5s 
 plot: [3,4] [======================>-------------------------------------------------------------------------------------] 21% est: 5s 
 plot: [3,5] [=======================>------------------------------------------------------------------------------------] 22% est: 5s 
 plot: [3,6] [========================>-----------------------------------------------------------------------------------] 23% est: 5s 
 plot: [3,7] [=========================>----------------------------------------------------------------------------------] 24% est: 5s 
 plot: [3,8] [==========================>---------------------------------------------------------------------------------] 25% est: 5s 
 plot: [3,9] [===========================>--------------------------------------------------------------------------------] 26% est: 5s 
 plot: [3,10] [===========================>-------------------------------------------------------------------------------] 26% est: 5s 
 plot: [3,11] [============================>------------------------------------------------------------------------------] 27% est: 5s 
 plot: [4,1] [=============================>------------------------------------------------------------------------------] 28% est: 5s 
 plot: [4,2] [==============================>-----------------------------------------------------------------------------] 29% est: 5s 
 plot: [4,3] [===============================>----------------------------------------------------------------------------] 30% est: 5s 
 plot: [4,4] [================================>---------------------------------------------------------------------------] 31% est: 5s 
 plot: [4,5] [=================================>--------------------------------------------------------------------------] 31% est: 5s 
 plot: [4,6] [==================================>-------------------------------------------------------------------------] 32% est: 4s 
 plot: [4,7] [===================================>------------------------------------------------------------------------] 33% est: 4s 
 plot: [4,8] [====================================>-----------------------------------------------------------------------] 34% est: 4s 
 plot: [4,9] [====================================>-----------------------------------------------------------------------] 35% est: 4s 
 plot: [4,10] [=====================================>---------------------------------------------------------------------] 36% est: 4s 
 plot: [4,11] [======================================>--------------------------------------------------------------------] 36% est: 4s 
 plot: [5,1] [=======================================>--------------------------------------------------------------------] 37% est: 4s 
 plot: [5,2] [========================================>-------------------------------------------------------------------] 38% est: 4s 
 plot: [5,3] [=========================================>------------------------------------------------------------------] 39% est: 4s 
 plot: [5,4] [==========================================>-----------------------------------------------------------------] 40% est: 4s 
 plot: [5,5] [===========================================>----------------------------------------------------------------] 40% est: 4s 
 plot: [5,6] [============================================>---------------------------------------------------------------] 41% est: 4s 
 plot: [5,7] [=============================================>--------------------------------------------------------------] 42% est: 4s 
 plot: [5,8] [=============================================>--------------------------------------------------------------] 43% est: 4s 
 plot: [5,9] [==============================================>-------------------------------------------------------------] 44% est: 4s 
 plot: [5,10] [===============================================>-----------------------------------------------------------] 45% est: 4s 
 plot: [5,11] [================================================>----------------------------------------------------------] 45% est: 4s 
 plot: [6,1] [=================================================>----------------------------------------------------------] 46% est: 4s 
 plot: [6,2] [==================================================>---------------------------------------------------------] 47% est: 4s 
 plot: [6,3] [===================================================>--------------------------------------------------------] 48% est: 3s 
 plot: [6,4] [====================================================>-------------------------------------------------------] 49% est: 3s 
 plot: [6,5] [=====================================================>------------------------------------------------------] 50% est: 3s 
 plot: [6,6] [=====================================================>------------------------------------------------------] 50% est: 3s 
 plot: [6,7] [======================================================>-----------------------------------------------------] 51% est: 3s 
 plot: [6,8] [=======================================================>----------------------------------------------------] 52% est: 3s 
 plot: [6,9] [========================================================>---------------------------------------------------] 53% est: 3s 
 plot: [6,10] [========================================================>--------------------------------------------------] 54% est: 3s 
 plot: [6,11] [=========================================================>-------------------------------------------------] 55% est: 3s 
 plot: [7,1] [===========================================================>------------------------------------------------] 55% est: 3s 
 plot: [7,2] [============================================================>-----------------------------------------------] 56% est: 3s 
 plot: [7,3] [=============================================================>----------------------------------------------] 57% est: 3s 
 plot: [7,4] [=============================================================>----------------------------------------------] 58% est: 3s 
 plot: [7,5] [==============================================================>---------------------------------------------] 59% est: 3s 
 plot: [7,6] [===============================================================>--------------------------------------------] 60% est: 3s 
 plot: [7,7] [================================================================>-------------------------------------------] 60% est: 3s 
 plot: [7,8] [=================================================================>------------------------------------------] 61% est: 3s 
 plot: [7,9] [==================================================================>-----------------------------------------] 62% est: 3s 
 plot: [7,10] [==================================================================>----------------------------------------] 63% est: 3s 
 plot: [7,11] [===================================================================>---------------------------------------] 64% est: 2s 
 plot: [8,1] [=====================================================================>--------------------------------------] 64% est: 2s 
 plot: [8,2] [======================================================================>-------------------------------------] 65% est: 2s 
 plot: [8,3] [======================================================================>-------------------------------------] 66% est: 2s 
 plot: [8,4] [=======================================================================>------------------------------------] 67% est: 2s 
 plot: [8,5] [========================================================================>-----------------------------------] 68% est: 2s 
 plot: [8,6] [=========================================================================>----------------------------------] 69% est: 2s 
 plot: [8,7] [==========================================================================>---------------------------------] 69% est: 2s 
 plot: [8,8] [===========================================================================>--------------------------------] 70% est: 2s 
 plot: [8,9] [============================================================================>-------------------------------] 71% est: 2s 
 plot: [8,10] [============================================================================>------------------------------] 72% est: 2s 
 plot: [8,11] [=============================================================================>-----------------------------] 73% est: 2s 
 plot: [9,1] [==============================================================================>-----------------------------] 74% est: 2s 
 plot: [9,2] [===============================================================================>----------------------------] 74% est: 2s 
 plot: [9,3] [================================================================================>---------------------------] 75% est: 2s 
 plot: [9,4] [=================================================================================>--------------------------] 76% est: 2s 
 plot: [9,5] [==================================================================================>-------------------------] 77% est: 2s 
 plot: [9,6] [===================================================================================>------------------------] 78% est: 2s 
 plot: [9,7] [====================================================================================>-----------------------] 79% est: 2s 
 plot: [9,8] [=====================================================================================>----------------------] 79% est: 2s 
 plot: [9,9] [======================================================================================>---------------------] 80% est: 1s 
 plot: [9,10] [======================================================================================>--------------------] 81% est: 1s 
 plot: [9,11] [=======================================================================================>-------------------] 82% est: 1s 
 plot: [10,1] [=======================================================================================>-------------------] 83% est: 1s 
 plot: [10,2] [========================================================================================>------------------] 83% est: 1s 
 plot: [10,3] [=========================================================================================>-----------------] 84% est: 1s 
 plot: [10,4] [==========================================================================================>----------------] 85% est: 1s 
 plot: [10,5] [===========================================================================================>---------------] 86% est: 1s 
 plot: [10,6] [============================================================================================>--------------] 87% est: 1s 
 plot: [10,7] [=============================================================================================>-------------] 88% est: 1s 
 plot: [10,8] [==============================================================================================>------------] 88% est: 1s 
 plot: [10,9] [===============================================================================================>-----------] 89% est: 1s 
 plot: [10,10] [==============================================================================================>-----------] 90% est: 1s 
 plot: [10,11] [===============================================================================================>----------] 91% est: 1s 
 plot: [11,1] [=================================================================================================>---------] 92% est: 1s 
 plot: [11,2] [==================================================================================================>--------] 93% est: 1s 
 plot: [11,3] [===================================================================================================>-------] 93% est: 0s 
 plot: [11,4] [====================================================================================================>------] 94% est: 0s 
 plot: [11,5] [=====================================================================================================>-----] 95% est: 0s 
 plot: [11,6] [======================================================================================================>----] 96% est: 0s 
 plot: [11,7] [======================================================================================================>----] 97% est: 0s 
 plot: [11,8] [=======================================================================================================>---] 98% est: 0s 
 plot: [11,9] [========================================================================================================>--] 98% est: 0s 
 plot: [11,10] [========================================================================================================>-] 99% est: 0s 
 plot: [11,11] [==========================================================================================================]100% est: 0s 
                                                                                                                                        

house_numeric %>% 
  select(ln_price, everything()) %>% 
  ggpairs()

 plot: [1,1] [>-----------------------------------------------------------------------------------------------------------]  1% est: 0s 
 plot: [1,2] [=>----------------------------------------------------------------------------------------------------------]  2% est: 5s 
 plot: [1,3] [==>---------------------------------------------------------------------------------------------------------]  2% est: 6s 
 plot: [1,4] [===>--------------------------------------------------------------------------------------------------------]  3% est: 6s 
 plot: [1,5] [===>--------------------------------------------------------------------------------------------------------]  4% est: 6s 
 plot: [1,6] [====>-------------------------------------------------------------------------------------------------------]  5% est: 6s 
 plot: [1,7] [=====>------------------------------------------------------------------------------------------------------]  6% est: 6s 
 plot: [1,8] [======>-----------------------------------------------------------------------------------------------------]  7% est: 6s 
 plot: [1,9] [=======>----------------------------------------------------------------------------------------------------]  7% est: 6s 
 plot: [1,10] [========>--------------------------------------------------------------------------------------------------]  8% est: 6s 
 plot: [1,11] [=========>-------------------------------------------------------------------------------------------------]  9% est: 6s 
 plot: [2,1] [==========>-------------------------------------------------------------------------------------------------] 10% est: 6s 
 plot: [2,2] [===========>------------------------------------------------------------------------------------------------] 11% est: 6s 
 plot: [2,3] [===========>------------------------------------------------------------------------------------------------] 12% est: 6s 
 plot: [2,4] [============>-----------------------------------------------------------------------------------------------] 12% est: 6s 
 plot: [2,5] [=============>----------------------------------------------------------------------------------------------] 13% est: 6s 
 plot: [2,6] [==============>---------------------------------------------------------------------------------------------] 14% est: 6s 
 plot: [2,7] [===============>--------------------------------------------------------------------------------------------] 15% est: 6s 
 plot: [2,8] [================>-------------------------------------------------------------------------------------------] 16% est: 6s 
 plot: [2,9] [=================>------------------------------------------------------------------------------------------] 17% est: 6s 
 plot: [2,10] [==================>----------------------------------------------------------------------------------------] 17% est: 5s 
 plot: [2,11] [==================>----------------------------------------------------------------------------------------] 18% est: 5s 
 plot: [3,1] [====================>---------------------------------------------------------------------------------------] 19% est: 5s 
 plot: [3,2] [====================>---------------------------------------------------------------------------------------] 20% est: 5s 
 plot: [3,3] [=====================>--------------------------------------------------------------------------------------] 21% est: 5s 
 plot: [3,4] [======================>-------------------------------------------------------------------------------------] 21% est: 5s 
 plot: [3,5] [=======================>------------------------------------------------------------------------------------] 22% est: 5s 
 plot: [3,6] [========================>-----------------------------------------------------------------------------------] 23% est: 5s 
 plot: [3,7] [=========================>----------------------------------------------------------------------------------] 24% est: 5s 
 plot: [3,8] [==========================>---------------------------------------------------------------------------------] 25% est: 5s 
 plot: [3,9] [===========================>--------------------------------------------------------------------------------] 26% est: 5s 
 plot: [3,10] [===========================>-------------------------------------------------------------------------------] 26% est: 5s 
 plot: [3,11] [============================>------------------------------------------------------------------------------] 27% est: 5s 
 plot: [4,1] [=============================>------------------------------------------------------------------------------] 28% est: 5s 
 plot: [4,2] [==============================>-----------------------------------------------------------------------------] 29% est: 5s 
 plot: [4,3] [===============================>----------------------------------------------------------------------------] 30% est: 5s 
 plot: [4,4] [================================>---------------------------------------------------------------------------] 31% est: 4s 
 plot: [4,5] [=================================>--------------------------------------------------------------------------] 31% est: 4s 
 plot: [4,6] [==================================>-------------------------------------------------------------------------] 32% est: 4s 
 plot: [4,7] [===================================>------------------------------------------------------------------------] 33% est: 4s 
 plot: [4,8] [====================================>-----------------------------------------------------------------------] 34% est: 4s 
 plot: [4,9] [====================================>-----------------------------------------------------------------------] 35% est: 4s 
 plot: [4,10] [=====================================>---------------------------------------------------------------------] 36% est: 4s 
 plot: [4,11] [======================================>--------------------------------------------------------------------] 36% est: 4s 
 plot: [5,1] [=======================================>--------------------------------------------------------------------] 37% est: 4s 
 plot: [5,2] [========================================>-------------------------------------------------------------------] 38% est: 4s 
 plot: [5,3] [=========================================>------------------------------------------------------------------] 39% est: 4s 
 plot: [5,4] [==========================================>-----------------------------------------------------------------] 40% est: 4s 
 plot: [5,5] [===========================================>----------------------------------------------------------------] 40% est: 4s 
 plot: [5,6] [============================================>---------------------------------------------------------------] 41% est: 4s 
 plot: [5,7] [=============================================>--------------------------------------------------------------] 42% est: 4s 
 plot: [5,8] [=============================================>--------------------------------------------------------------] 43% est: 4s 
 plot: [5,9] [==============================================>-------------------------------------------------------------] 44% est: 4s 
 plot: [5,10] [===============================================>-----------------------------------------------------------] 45% est: 4s 
 plot: [5,11] [================================================>----------------------------------------------------------] 45% est: 4s 
 plot: [6,1] [=================================================>----------------------------------------------------------] 46% est: 3s 
 plot: [6,2] [==================================================>---------------------------------------------------------] 47% est: 3s 
 plot: [6,3] [===================================================>--------------------------------------------------------] 48% est: 3s 
 plot: [6,4] [====================================================>-------------------------------------------------------] 49% est: 3s 
 plot: [6,5] [=====================================================>------------------------------------------------------] 50% est: 3s 
 plot: [6,6] [=====================================================>------------------------------------------------------] 50% est: 3s 
 plot: [6,7] [======================================================>-----------------------------------------------------] 51% est: 3s 
 plot: [6,8] [=======================================================>----------------------------------------------------] 52% est: 3s 
 plot: [6,9] [========================================================>---------------------------------------------------] 53% est: 3s 
 plot: [6,10] [========================================================>--------------------------------------------------] 54% est: 3s 
 plot: [6,11] [=========================================================>-------------------------------------------------] 55% est: 3s 
 plot: [7,1] [===========================================================>------------------------------------------------] 55% est: 3s 
 plot: [7,2] [============================================================>-----------------------------------------------] 56% est: 3s 
 plot: [7,3] [=============================================================>----------------------------------------------] 57% est: 3s 
 plot: [7,4] [=============================================================>----------------------------------------------] 58% est: 3s 
 plot: [7,5] [==============================================================>---------------------------------------------] 59% est: 3s 
 plot: [7,6] [===============================================================>--------------------------------------------] 60% est: 3s 
 plot: [7,7] [================================================================>-------------------------------------------] 60% est: 3s 
 plot: [7,8] [=================================================================>------------------------------------------] 61% est: 3s 
 plot: [7,9] [==================================================================>-----------------------------------------] 62% est: 2s 
 plot: [7,10] [==================================================================>----------------------------------------] 63% est: 2s 
 plot: [7,11] [===================================================================>---------------------------------------] 64% est: 2s 
 plot: [8,1] [=====================================================================>--------------------------------------] 64% est: 2s 
 plot: [8,2] [======================================================================>-------------------------------------] 65% est: 2s 
 plot: [8,3] [======================================================================>-------------------------------------] 66% est: 2s 
 plot: [8,4] [=======================================================================>------------------------------------] 67% est: 2s 
 plot: [8,5] [========================================================================>-----------------------------------] 68% est: 2s 
 plot: [8,6] [=========================================================================>----------------------------------] 69% est: 2s 
 plot: [8,7] [==========================================================================>---------------------------------] 69% est: 2s 
 plot: [8,8] [===========================================================================>--------------------------------] 70% est: 2s 
 plot: [8,9] [============================================================================>-------------------------------] 71% est: 2s 
 plot: [8,10] [============================================================================>------------------------------] 72% est: 2s 
 plot: [8,11] [=============================================================================>-----------------------------] 73% est: 2s 
 plot: [9,1] [==============================================================================>-----------------------------] 74% est: 2s 
 plot: [9,2] [===============================================================================>----------------------------] 74% est: 2s 
 plot: [9,3] [================================================================================>---------------------------] 75% est: 2s 
 plot: [9,4] [=================================================================================>--------------------------] 76% est: 2s 
 plot: [9,5] [==================================================================================>-------------------------] 77% est: 2s 
 plot: [9,6] [===================================================================================>------------------------] 78% est: 1s 
 plot: [9,7] [====================================================================================>-----------------------] 79% est: 1s 
 plot: [9,8] [=====================================================================================>----------------------] 79% est: 1s 
 plot: [9,9] [======================================================================================>---------------------] 80% est: 1s 
 plot: [9,10] [======================================================================================>--------------------] 81% est: 1s 
 plot: [9,11] [=======================================================================================>-------------------] 82% est: 1s 
 plot: [10,1] [=======================================================================================>-------------------] 83% est: 1s 
 plot: [10,2] [========================================================================================>------------------] 83% est: 1s 
 plot: [10,3] [=========================================================================================>-----------------] 84% est: 1s 
 plot: [10,4] [==========================================================================================>----------------] 85% est: 1s 
 plot: [10,5] [===========================================================================================>---------------] 86% est: 1s 
 plot: [10,6] [============================================================================================>--------------] 87% est: 1s 
 plot: [10,7] [=============================================================================================>-------------] 88% est: 1s 
 plot: [10,8] [==============================================================================================>------------] 88% est: 1s 
 plot: [10,9] [===============================================================================================>-----------] 89% est: 1s 
 plot: [10,10] [==============================================================================================>-----------] 90% est: 1s 
 plot: [10,11] [===============================================================================================>----------] 91% est: 1s 
 plot: [11,1] [=================================================================================================>---------] 92% est: 1s 
 plot: [11,2] [==================================================================================================>--------] 93% est: 0s 
 plot: [11,3] [===================================================================================================>-------] 93% est: 0s 
 plot: [11,4] [====================================================================================================>------] 94% est: 0s 
 plot: [11,5] [=====================================================================================================>-----] 95% est: 0s 
 plot: [11,6] [======================================================================================================>----] 96% est: 0s 
 plot: [11,7] [======================================================================================================>----] 97% est: 0s 
 plot: [11,8] [=======================================================================================================>---] 98% est: 0s 
 plot: [11,9] [========================================================================================================>--] 98% est: 0s 
 plot: [11,10] [========================================================================================================>-] 99% est: 0s 
 plot: [11,11] [==========================================================================================================]100% est: 0s 
                                                                                                                                        

investigate:

  • sqft living
  • sqft above
  • bathrooms
  • bedrooms
house_nonnumeric %>%
  select(price, everything()) %>% 
  ggpairs()

 plot: [1,1] [=>----------------------------------------------------------------------------------------------------------]  2% est: 0s 
 plot: [1,2] [===>--------------------------------------------------------------------------------------------------------]  4% est: 2s 
 plot: [1,3] [======>-----------------------------------------------------------------------------------------------------]  6% est: 2s 
 plot: [1,4] [========>---------------------------------------------------------------------------------------------------]  8% est: 3s 
 plot: [1,5] [==========>-------------------------------------------------------------------------------------------------] 10% est: 3s 
 plot: [1,6] [============>-----------------------------------------------------------------------------------------------] 12% est: 3s 
 plot: [1,7] [==============>---------------------------------------------------------------------------------------------] 14% est: 3s 
 plot: [2,1] [=================>------------------------------------------------------------------------------------------] 16% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [2,2] [===================>----------------------------------------------------------------------------------------] 18% est: 3s 
 plot: [2,3] [=====================>--------------------------------------------------------------------------------------] 20% est: 3s 
 plot: [2,4] [=======================>------------------------------------------------------------------------------------] 22% est: 3s 
 plot: [2,5] [=========================>----------------------------------------------------------------------------------] 24% est: 3s 
 plot: [2,6] [============================>-------------------------------------------------------------------------------] 27% est: 2s 
 plot: [2,7] [==============================>-----------------------------------------------------------------------------] 29% est: 2s 
 plot: [3,1] [================================>---------------------------------------------------------------------------] 31% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [3,2] [==================================>-------------------------------------------------------------------------] 33% est: 3s 
 plot: [3,3] [====================================>-----------------------------------------------------------------------] 35% est: 3s 
 plot: [3,4] [=======================================>--------------------------------------------------------------------] 37% est: 3s 
 plot: [3,5] [=========================================>------------------------------------------------------------------] 39% est: 2s 
 plot: [3,6] [===========================================>----------------------------------------------------------------] 41% est: 2s 
 plot: [3,7] [=============================================>--------------------------------------------------------------] 43% est: 2s 
 plot: [4,1] [===============================================>------------------------------------------------------------] 45% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [4,2] [==================================================>---------------------------------------------------------] 47% est: 2s 
 plot: [4,3] [====================================================>-------------------------------------------------------] 49% est: 2s 
 plot: [4,4] [======================================================>-----------------------------------------------------] 51% est: 2s 
 plot: [4,5] [========================================================>---------------------------------------------------] 53% est: 2s 
 plot: [4,6] [===========================================================>------------------------------------------------] 55% est: 2s 
 plot: [4,7] [=============================================================>----------------------------------------------] 57% est: 2s 
 plot: [5,1] [===============================================================>--------------------------------------------] 59% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [5,2] [=================================================================>------------------------------------------] 61% est: 2s 
 plot: [5,3] [===================================================================>----------------------------------------] 63% est: 2s 
 plot: [5,4] [======================================================================>-------------------------------------] 65% est: 2s 
 plot: [5,5] [========================================================================>-----------------------------------] 67% est: 2s 
 plot: [5,6] [==========================================================================>---------------------------------] 69% est: 2s 
 plot: [5,7] [============================================================================>-------------------------------] 71% est: 2s 
 plot: [6,1] [==============================================================================>-----------------------------] 73% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [6,2] [=================================================================================>--------------------------] 76% est: 1s 
 plot: [6,3] [===================================================================================>------------------------] 78% est: 1s 
 plot: [6,4] [=====================================================================================>----------------------] 80% est: 1s 
 plot: [6,5] [=======================================================================================>--------------------] 82% est: 1s 
 plot: [6,6] [=========================================================================================>------------------] 84% est: 1s 
 plot: [6,7] [============================================================================================>---------------] 86% est: 1s 
 plot: [7,1] [==============================================================================================>-------------] 88% est: 1s 
 plot: [7,2] [================================================================================================>-----------] 90% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,3] [==================================================================================================>---------] 92% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,4] [====================================================================================================>-------] 94% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,5] [=======================================================================================================>----] 96% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,6] [=========================================================================================================>--] 98% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,7] [============================================================================================================]100% est: 0s 
                                                                                                                                        

house_nonnumeric %>% 
  select(ln_price, everything()) %>% 
  ggpairs()

 plot: [1,1] [=>----------------------------------------------------------------------------------------------------------]  2% est: 0s 
 plot: [1,2] [===>--------------------------------------------------------------------------------------------------------]  4% est: 1s 
 plot: [1,3] [======>-----------------------------------------------------------------------------------------------------]  6% est: 2s 
 plot: [1,4] [========>---------------------------------------------------------------------------------------------------]  8% est: 2s 
 plot: [1,5] [==========>-------------------------------------------------------------------------------------------------] 10% est: 2s 
 plot: [1,6] [============>-----------------------------------------------------------------------------------------------] 12% est: 2s 
 plot: [1,7] [==============>---------------------------------------------------------------------------------------------] 14% est: 2s 
 plot: [2,1] [=================>------------------------------------------------------------------------------------------] 16% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [2,2] [===================>----------------------------------------------------------------------------------------] 18% est: 3s 
 plot: [2,3] [=====================>--------------------------------------------------------------------------------------] 20% est: 2s 
 plot: [2,4] [=======================>------------------------------------------------------------------------------------] 22% est: 2s 
 plot: [2,5] [=========================>----------------------------------------------------------------------------------] 24% est: 2s 
 plot: [2,6] [============================>-------------------------------------------------------------------------------] 27% est: 2s 
 plot: [2,7] [==============================>-----------------------------------------------------------------------------] 29% est: 2s 
 plot: [3,1] [================================>---------------------------------------------------------------------------] 31% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [3,2] [==================================>-------------------------------------------------------------------------] 33% est: 2s 
 plot: [3,3] [====================================>-----------------------------------------------------------------------] 35% est: 2s 
 plot: [3,4] [=======================================>--------------------------------------------------------------------] 37% est: 2s 
 plot: [3,5] [=========================================>------------------------------------------------------------------] 39% est: 2s 
 plot: [3,6] [===========================================>----------------------------------------------------------------] 41% est: 2s 
 plot: [3,7] [=============================================>--------------------------------------------------------------] 43% est: 2s 
 plot: [4,1] [===============================================>------------------------------------------------------------] 45% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [4,2] [==================================================>---------------------------------------------------------] 47% est: 2s 
 plot: [4,3] [====================================================>-------------------------------------------------------] 49% est: 2s 
 plot: [4,4] [======================================================>-----------------------------------------------------] 51% est: 2s 
 plot: [4,5] [========================================================>---------------------------------------------------] 53% est: 2s 
 plot: [4,6] [===========================================================>------------------------------------------------] 55% est: 2s 
 plot: [4,7] [=============================================================>----------------------------------------------] 57% est: 2s 
 plot: [5,1] [===============================================================>--------------------------------------------] 59% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [5,2] [=================================================================>------------------------------------------] 61% est: 2s 
 plot: [5,3] [===================================================================>----------------------------------------] 63% est: 2s 
 plot: [5,4] [======================================================================>-------------------------------------] 65% est: 2s 
 plot: [5,5] [========================================================================>-----------------------------------] 67% est: 2s 
 plot: [5,6] [==========================================================================>---------------------------------] 69% est: 2s 
 plot: [5,7] [============================================================================>-------------------------------] 71% est: 2s 
 plot: [6,1] [==============================================================================>-----------------------------] 73% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [6,2] [=================================================================================>--------------------------] 76% est: 1s 
 plot: [6,3] [===================================================================================>------------------------] 78% est: 1s 
 plot: [6,4] [=====================================================================================>----------------------] 80% est: 1s 
 plot: [6,5] [=======================================================================================>--------------------] 82% est: 1s 
 plot: [6,6] [=========================================================================================>------------------] 84% est: 1s 
 plot: [6,7] [============================================================================================>---------------] 86% est: 1s 
 plot: [7,1] [==============================================================================================>-------------] 88% est: 1s 
 plot: [7,2] [================================================================================================>-----------] 90% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,3] [==================================================================================================>---------] 92% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,4] [====================================================================================================>-------] 94% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,5] [=======================================================================================================>----] 96% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,6] [=========================================================================================================>--] 98% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,7] [============================================================================================================]100% est: 0s 
                                                                                                                                        

investigate:

  • grade
  • waterfront
  • view
  • condition

First model

mod1a1 <- lm(ln_price ~ sqft_living,
            data = house)

summary(mod1a1)

Call:
lm(formula = ln_price ~ sqft_living, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.97781 -0.28543  0.01472  0.26070  1.27628 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 1.222e+01  6.374e-03  1916.9   <2e-16 ***
sqft_living 3.987e-04  2.803e-06   142.2   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3785 on 21611 degrees of freedom
Multiple R-squared:  0.4835,    Adjusted R-squared:  0.4835 
F-statistic: 2.023e+04 on 1 and 21611 DF,  p-value: < 2.2e-16
autoplot(mod1a1)

mod1a2 <- lm(price ~ sqft_living,
            data = house)

summary(mod1a2)

Call:
lm(formula = price ~ sqft_living, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1476062  -147486   -24043   106182  4362067 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -43580.743   4402.690  -9.899   <2e-16 ***
sqft_living    280.624      1.936 144.920   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 261500 on 21611 degrees of freedom
Multiple R-squared:  0.4929,    Adjusted R-squared:  0.4928 
F-statistic: 2.1e+04 on 1 and 21611 DF,  p-value: < 2.2e-16
autoplot(mod1a2)

mod1b1 <- lm(ln_price ~ grade,
             data = house)

summary(mod1b1)

Call:
lm(formula = ln_price ~ grade, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.42892 -0.26231 -0.00483  0.24505  1.80117 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 13.159997   0.037667 349.378  < 2e-16 ***
grade.L      3.380842   0.197635  17.106  < 2e-16 ***
grade.Q      0.565833   0.200908   2.816  0.00486 ** 
grade.C     -0.012459   0.180001  -0.069  0.94482    
grade^4      0.014025   0.159772   0.088  0.93005    
grade^5      0.122204   0.142440   0.858  0.39094    
grade^6     -0.019036   0.120748  -0.158  0.87473    
grade^7      0.010765   0.093391   0.115  0.90823    
grade^8     -0.007330   0.064806  -0.113  0.90995    
grade^9     -0.004064   0.039929  -0.102  0.91893    
grade^10     0.004848   0.021378   0.227  0.82060    
grade^11     0.015221   0.009383   1.622  0.10476    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3735 on 21601 degrees of freedom
Multiple R-squared:  0.4973,    Adjusted R-squared:  0.4971 
F-statistic:  1943 on 11 and 21601 DF,  p-value: < 2.2e-16
autoplot(mod1b1)
Warning: Removed 275 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

mod1b2 <- lm(price ~ grade,
             data = house)

summary(mod1b2)

Call:
lm(formula = price ~ grade, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1929615  -135853   -35090    89080  5565658 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   941742      25666  36.693  < 2e-16 ***
grade.L      3000531     134665  22.281  < 2e-16 ***
grade.Q      1703928     136895  12.447  < 2e-16 ***
grade.C       757073     122650   6.173 6.84e-10 ***
grade^4       314354     108866   2.888  0.00389 ** 
grade^5       198604      97056   2.046  0.04074 *  
grade^6        78933      82275   0.959  0.33738    
grade^7        39242      63635   0.617  0.53746    
grade^8         2243      44158   0.051  0.95948    
grade^9         2531      27207   0.093  0.92589    
grade^10        1258      14567   0.086  0.93116    
grade^11        8633       6393   1.350  0.17694    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 254500 on 21601 degrees of freedom
Multiple R-squared:  0.5197,    Adjusted R-squared:  0.5195 
F-statistic:  2125 on 11 and 21601 DF,  p-value: < 2.2e-16
autoplot(mod1b2)
Warning: Removed 2313 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

Choose sqft_living as first predictor

Look at residuals

house_resid_numeric_log <- house_numeric %>% 
  add_residuals(mod1a1) %>% 
  select(-c(ln_price, sqft_living))

house_resid_numeric_log %>% 
  select(resid, everything()) %>% 
  ggpairs()

 plot: [1,1] [>-----------------------------------------------------------------------------------------------------------]  1% est: 0s 
 plot: [1,2] [=>----------------------------------------------------------------------------------------------------------]  2% est: 3s 
 plot: [1,3] [==>---------------------------------------------------------------------------------------------------------]  3% est: 4s 
 plot: [1,4] [===>--------------------------------------------------------------------------------------------------------]  4% est: 4s 
 plot: [1,5] [====>-------------------------------------------------------------------------------------------------------]  5% est: 4s 
 plot: [1,6] [=====>------------------------------------------------------------------------------------------------------]  6% est: 4s 
 plot: [1,7] [=======>----------------------------------------------------------------------------------------------------]  7% est: 5s 
 plot: [1,8] [========>---------------------------------------------------------------------------------------------------]  8% est: 5s 
 plot: [1,9] [=========>--------------------------------------------------------------------------------------------------]  9% est: 5s 
 plot: [1,10] [==========>------------------------------------------------------------------------------------------------] 10% est: 5s 
 plot: [2,1] [===========>------------------------------------------------------------------------------------------------] 11% est: 5s 
 plot: [2,2] [============>-----------------------------------------------------------------------------------------------] 12% est: 5s 
 plot: [2,3] [=============>----------------------------------------------------------------------------------------------] 13% est: 5s 
 plot: [2,4] [==============>---------------------------------------------------------------------------------------------] 14% est: 5s 
 plot: [2,5] [===============>--------------------------------------------------------------------------------------------] 15% est: 5s 
 plot: [2,6] [================>-------------------------------------------------------------------------------------------] 16% est: 5s 
 plot: [2,7] [=================>------------------------------------------------------------------------------------------] 17% est: 5s 
 plot: [2,8] [==================>-----------------------------------------------------------------------------------------] 18% est: 4s 
 plot: [2,9] [====================>---------------------------------------------------------------------------------------] 19% est: 4s 
 plot: [2,10] [====================>--------------------------------------------------------------------------------------] 20% est: 4s 
 plot: [3,1] [======================>-------------------------------------------------------------------------------------] 21% est: 4s 
 plot: [3,2] [=======================>------------------------------------------------------------------------------------] 22% est: 4s 
 plot: [3,3] [========================>-----------------------------------------------------------------------------------] 23% est: 4s 
 plot: [3,4] [=========================>----------------------------------------------------------------------------------] 24% est: 4s 
 plot: [3,5] [==========================>---------------------------------------------------------------------------------] 25% est: 4s 
 plot: [3,6] [===========================>--------------------------------------------------------------------------------] 26% est: 4s 
 plot: [3,7] [============================>-------------------------------------------------------------------------------] 27% est: 4s 
 plot: [3,8] [=============================>------------------------------------------------------------------------------] 28% est: 4s 
 plot: [3,9] [==============================>-----------------------------------------------------------------------------] 29% est: 4s 
 plot: [3,10] [===============================>---------------------------------------------------------------------------] 30% est: 4s 
 plot: [4,1] [================================>---------------------------------------------------------------------------] 31% est: 4s 
 plot: [4,2] [==================================>-------------------------------------------------------------------------] 32% est: 4s 
 plot: [4,3] [===================================>------------------------------------------------------------------------] 33% est: 4s 
 plot: [4,4] [====================================>-----------------------------------------------------------------------] 34% est: 4s 
 plot: [4,5] [=====================================>----------------------------------------------------------------------] 35% est: 4s 
 plot: [4,6] [======================================>---------------------------------------------------------------------] 36% est: 4s 
 plot: [4,7] [=======================================>--------------------------------------------------------------------] 37% est: 3s 
 plot: [4,8] [========================================>-------------------------------------------------------------------] 38% est: 3s 
 plot: [4,9] [=========================================>------------------------------------------------------------------] 39% est: 3s 
 plot: [4,10] [==========================================>----------------------------------------------------------------] 40% est: 3s 
 plot: [5,1] [===========================================>----------------------------------------------------------------] 41% est: 3s 
 plot: [5,2] [============================================>---------------------------------------------------------------] 42% est: 3s 
 plot: [5,3] [=============================================>--------------------------------------------------------------] 43% est: 3s 
 plot: [5,4] [===============================================>------------------------------------------------------------] 44% est: 3s 
 plot: [5,5] [================================================>-----------------------------------------------------------] 45% est: 3s 
 plot: [5,6] [=================================================>----------------------------------------------------------] 46% est: 3s 
 plot: [5,7] [==================================================>---------------------------------------------------------] 47% est: 3s 
 plot: [5,8] [===================================================>--------------------------------------------------------] 48% est: 3s 
 plot: [5,9] [====================================================>-------------------------------------------------------] 49% est: 3s 
 plot: [5,10] [=====================================================>-----------------------------------------------------] 50% est: 3s 
 plot: [6,1] [======================================================>-----------------------------------------------------] 51% est: 3s 
 plot: [6,2] [=======================================================>----------------------------------------------------] 52% est: 3s 
 plot: [6,3] [========================================================>---------------------------------------------------] 53% est: 3s 
 plot: [6,4] [=========================================================>--------------------------------------------------] 54% est: 2s 
 plot: [6,5] [==========================================================>-------------------------------------------------] 55% est: 2s 
 plot: [6,6] [===========================================================>------------------------------------------------] 56% est: 2s 
 plot: [6,7] [=============================================================>----------------------------------------------] 57% est: 2s 
 plot: [6,8] [==============================================================>---------------------------------------------] 58% est: 2s 
 plot: [6,9] [===============================================================>--------------------------------------------] 59% est: 2s 
 plot: [6,10] [===============================================================>-------------------------------------------] 60% est: 2s 
 plot: [7,1] [=================================================================>------------------------------------------] 61% est: 2s 
 plot: [7,2] [==================================================================>-----------------------------------------] 62% est: 2s 
 plot: [7,3] [===================================================================>----------------------------------------] 63% est: 2s 
 plot: [7,4] [====================================================================>---------------------------------------] 64% est: 2s 
 plot: [7,5] [=====================================================================>--------------------------------------] 65% est: 2s 
 plot: [7,6] [======================================================================>-------------------------------------] 66% est: 2s 
 plot: [7,7] [=======================================================================>------------------------------------] 67% est: 2s 
 plot: [7,8] [========================================================================>-----------------------------------] 68% est: 2s 
 plot: [7,9] [==========================================================================>---------------------------------] 69% est: 2s 
 plot: [7,10] [==========================================================================>--------------------------------] 70% est: 2s 
 plot: [8,1] [============================================================================>-------------------------------] 71% est: 2s 
 plot: [8,2] [=============================================================================>------------------------------] 72% est: 2s 
 plot: [8,3] [==============================================================================>-----------------------------] 73% est: 1s 
 plot: [8,4] [===============================================================================>----------------------------] 74% est: 1s 
 plot: [8,5] [================================================================================>---------------------------] 75% est: 1s 
 plot: [8,6] [=================================================================================>--------------------------] 76% est: 1s 
 plot: [8,7] [==================================================================================>-------------------------] 77% est: 1s 
 plot: [8,8] [===================================================================================>------------------------] 78% est: 1s 
 plot: [8,9] [====================================================================================>-----------------------] 79% est: 1s 
 plot: [8,10] [=====================================================================================>---------------------] 80% est: 1s 
 plot: [9,1] [======================================================================================>---------------------] 81% est: 1s 
 plot: [9,2] [========================================================================================>-------------------] 82% est: 1s 
 plot: [9,3] [=========================================================================================>------------------] 83% est: 1s 
 plot: [9,4] [==========================================================================================>-----------------] 84% est: 1s 
 plot: [9,5] [===========================================================================================>----------------] 85% est: 1s 
 plot: [9,6] [============================================================================================>---------------] 86% est: 1s 
 plot: [9,7] [=============================================================================================>--------------] 87% est: 1s 
 plot: [9,8] [==============================================================================================>-------------] 88% est: 1s 
 plot: [9,9] [===============================================================================================>------------] 89% est: 1s 
 plot: [9,10] [===============================================================================================>-----------] 90% est: 1s 
 plot: [10,1] [================================================================================================>----------] 91% est: 0s 
 plot: [10,2] [=================================================================================================>---------] 92% est: 0s 
 plot: [10,3] [===================================================================================================>-------] 93% est: 0s 
 plot: [10,4] [====================================================================================================>------] 94% est: 0s 
 plot: [10,5] [=====================================================================================================>-----] 95% est: 0s 
 plot: [10,6] [======================================================================================================>----] 96% est: 0s 
 plot: [10,7] [=======================================================================================================>---] 97% est: 0s 
 plot: [10,8] [========================================================================================================>--] 98% est: 0s 
 plot: [10,9] [=========================================================================================================>-] 99% est: 0s 
 plot: [10,10] [==========================================================================================================]100% est: 0s 
                                                                                                                                        

  • lat
house_resid_numeric <- house_numeric %>% 
  add_residuals(mod1a2) %>% 
  select(-c(price, sqft_living))

house_resid_numeric %>% 
  select(resid, everything()) %>% 
  ggpairs()

 plot: [1,1] [>-----------------------------------------------------------------------------------------------------------]  1% est: 0s 
 plot: [1,2] [=>----------------------------------------------------------------------------------------------------------]  2% est: 3s 
 plot: [1,3] [==>---------------------------------------------------------------------------------------------------------]  3% est: 4s 
 plot: [1,4] [===>--------------------------------------------------------------------------------------------------------]  4% est: 5s 
 plot: [1,5] [====>-------------------------------------------------------------------------------------------------------]  5% est: 5s 
 plot: [1,6] [=====>------------------------------------------------------------------------------------------------------]  6% est: 5s 
 plot: [1,7] [=======>----------------------------------------------------------------------------------------------------]  7% est: 5s 
 plot: [1,8] [========>---------------------------------------------------------------------------------------------------]  8% est: 5s 
 plot: [1,9] [=========>--------------------------------------------------------------------------------------------------]  9% est: 5s 
 plot: [1,10] [==========>------------------------------------------------------------------------------------------------] 10% est: 5s 
 plot: [2,1] [===========>------------------------------------------------------------------------------------------------] 11% est: 5s 
 plot: [2,2] [============>-----------------------------------------------------------------------------------------------] 12% est: 5s 
 plot: [2,3] [=============>----------------------------------------------------------------------------------------------] 13% est: 5s 
 plot: [2,4] [==============>---------------------------------------------------------------------------------------------] 14% est: 5s 
 plot: [2,5] [===============>--------------------------------------------------------------------------------------------] 15% est: 5s 
 plot: [2,6] [================>-------------------------------------------------------------------------------------------] 16% est: 5s 
 plot: [2,7] [=================>------------------------------------------------------------------------------------------] 17% est: 5s 
 plot: [2,8] [==================>-----------------------------------------------------------------------------------------] 18% est: 5s 
 plot: [2,9] [====================>---------------------------------------------------------------------------------------] 19% est: 5s 
 plot: [2,10] [====================>--------------------------------------------------------------------------------------] 20% est: 4s 
 plot: [3,1] [======================>-------------------------------------------------------------------------------------] 21% est: 4s 
 plot: [3,2] [=======================>------------------------------------------------------------------------------------] 22% est: 4s 
 plot: [3,3] [========================>-----------------------------------------------------------------------------------] 23% est: 4s 
 plot: [3,4] [=========================>----------------------------------------------------------------------------------] 24% est: 4s 
 plot: [3,5] [==========================>---------------------------------------------------------------------------------] 25% est: 4s 
 plot: [3,6] [===========================>--------------------------------------------------------------------------------] 26% est: 4s 
 plot: [3,7] [============================>-------------------------------------------------------------------------------] 27% est: 4s 
 plot: [3,8] [=============================>------------------------------------------------------------------------------] 28% est: 4s 
 plot: [3,9] [==============================>-----------------------------------------------------------------------------] 29% est: 4s 
 plot: [3,10] [===============================>---------------------------------------------------------------------------] 30% est: 4s 
 plot: [4,1] [================================>---------------------------------------------------------------------------] 31% est: 4s 
 plot: [4,2] [==================================>-------------------------------------------------------------------------] 32% est: 4s 
 plot: [4,3] [===================================>------------------------------------------------------------------------] 33% est: 4s 
 plot: [4,4] [====================================>-----------------------------------------------------------------------] 34% est: 4s 
 plot: [4,5] [=====================================>----------------------------------------------------------------------] 35% est: 3s 
 plot: [4,6] [======================================>---------------------------------------------------------------------] 36% est: 3s 
 plot: [4,7] [=======================================>--------------------------------------------------------------------] 37% est: 3s 
 plot: [4,8] [========================================>-------------------------------------------------------------------] 38% est: 3s 
 plot: [4,9] [=========================================>------------------------------------------------------------------] 39% est: 3s 
 plot: [4,10] [==========================================>----------------------------------------------------------------] 40% est: 3s 
 plot: [5,1] [===========================================>----------------------------------------------------------------] 41% est: 3s 
 plot: [5,2] [============================================>---------------------------------------------------------------] 42% est: 3s 
 plot: [5,3] [=============================================>--------------------------------------------------------------] 43% est: 3s 
 plot: [5,4] [===============================================>------------------------------------------------------------] 44% est: 3s 
 plot: [5,5] [================================================>-----------------------------------------------------------] 45% est: 3s 
 plot: [5,6] [=================================================>----------------------------------------------------------] 46% est: 3s 
 plot: [5,7] [==================================================>---------------------------------------------------------] 47% est: 3s 
 plot: [5,8] [===================================================>--------------------------------------------------------] 48% est: 3s 
 plot: [5,9] [====================================================>-------------------------------------------------------] 49% est: 3s 
 plot: [5,10] [=====================================================>-----------------------------------------------------] 50% est: 3s 
 plot: [6,1] [======================================================>-----------------------------------------------------] 51% est: 3s 
 plot: [6,2] [=======================================================>----------------------------------------------------] 52% est: 3s 
 plot: [6,3] [========================================================>---------------------------------------------------] 53% est: 2s 
 plot: [6,4] [=========================================================>--------------------------------------------------] 54% est: 2s 
 plot: [6,5] [==========================================================>-------------------------------------------------] 55% est: 2s 
 plot: [6,6] [===========================================================>------------------------------------------------] 56% est: 3s 
 plot: [6,7] [=============================================================>----------------------------------------------] 57% est: 2s 
 plot: [6,8] [==============================================================>---------------------------------------------] 58% est: 2s 
 plot: [6,9] [===============================================================>--------------------------------------------] 59% est: 2s 
 plot: [6,10] [===============================================================>-------------------------------------------] 60% est: 2s 
 plot: [7,1] [=================================================================>------------------------------------------] 61% est: 2s 
 plot: [7,2] [==================================================================>-----------------------------------------] 62% est: 2s 
 plot: [7,3] [===================================================================>----------------------------------------] 63% est: 2s 
 plot: [7,4] [====================================================================>---------------------------------------] 64% est: 2s 
 plot: [7,5] [=====================================================================>--------------------------------------] 65% est: 2s 
 plot: [7,6] [======================================================================>-------------------------------------] 66% est: 2s 
 plot: [7,7] [=======================================================================>------------------------------------] 67% est: 2s 
 plot: [7,8] [========================================================================>-----------------------------------] 68% est: 2s 
 plot: [7,9] [==========================================================================>---------------------------------] 69% est: 2s 
 plot: [7,10] [==========================================================================>--------------------------------] 70% est: 2s 
 plot: [8,1] [============================================================================>-------------------------------] 71% est: 2s 
 plot: [8,2] [=============================================================================>------------------------------] 72% est: 2s 
 plot: [8,3] [==============================================================================>-----------------------------] 73% est: 2s 
 plot: [8,4] [===============================================================================>----------------------------] 74% est: 1s 
 plot: [8,5] [================================================================================>---------------------------] 75% est: 1s 
 plot: [8,6] [=================================================================================>--------------------------] 76% est: 1s 
 plot: [8,7] [==================================================================================>-------------------------] 77% est: 1s 
 plot: [8,8] [===================================================================================>------------------------] 78% est: 1s 
 plot: [8,9] [====================================================================================>-----------------------] 79% est: 1s 
 plot: [8,10] [=====================================================================================>---------------------] 80% est: 1s 
 plot: [9,1] [======================================================================================>---------------------] 81% est: 1s 
 plot: [9,2] [========================================================================================>-------------------] 82% est: 1s 
 plot: [9,3] [=========================================================================================>------------------] 83% est: 1s 
 plot: [9,4] [==========================================================================================>-----------------] 84% est: 1s 
 plot: [9,5] [===========================================================================================>----------------] 85% est: 1s 
 plot: [9,6] [============================================================================================>---------------] 86% est: 1s 
 plot: [9,7] [=============================================================================================>--------------] 87% est: 1s 
 plot: [9,8] [==============================================================================================>-------------] 88% est: 1s 
 plot: [9,9] [===============================================================================================>------------] 89% est: 1s 
 plot: [9,10] [===============================================================================================>-----------] 90% est: 1s 
 plot: [10,1] [================================================================================================>----------] 91% est: 1s 
 plot: [10,2] [=================================================================================================>---------] 92% est: 0s 
 plot: [10,3] [===================================================================================================>-------] 93% est: 0s 
 plot: [10,4] [====================================================================================================>------] 94% est: 0s 
 plot: [10,5] [=====================================================================================================>-----] 95% est: 0s 
 plot: [10,6] [======================================================================================================>----] 96% est: 0s 
 plot: [10,7] [=======================================================================================================>---] 97% est: 0s 
 plot: [10,8] [========================================================================================================>--] 98% est: 0s 
 plot: [10,9] [=========================================================================================================>-] 99% est: 0s 
 plot: [10,10] [==========================================================================================================]100% est: 0s 
                                                                                                                                        

  • bedrooms
house_resid <- house %>% 
  add_residuals(mod1a1) %>% 
  select(-c(ln_price, sqft_living))

house_resid %>% 
  select(resid, everything()) %>% 
  ggpairs()

 plot: [1,1] [------------------------------------------------------------------------------------------------------------]  0% est: 0s 
 plot: [1,2] [>-----------------------------------------------------------------------------------------------------------]  1% est: 8s 
 plot: [1,3] [>-----------------------------------------------------------------------------------------------------------]  1% est:10s 
 plot: [1,4] [=>----------------------------------------------------------------------------------------------------------]  2% est:11s 
 plot: [1,5] [=>----------------------------------------------------------------------------------------------------------]  2% est:11s 
 plot: [1,6] [==>---------------------------------------------------------------------------------------------------------]  3% est:11s 
 plot: [1,7] [==>---------------------------------------------------------------------------------------------------------]  3% est:11s 
 plot: [1,8] [===>--------------------------------------------------------------------------------------------------------]  4% est:11s 
 plot: [1,9] [===>--------------------------------------------------------------------------------------------------------]  4% est:12s 
 plot: [1,10] [====>------------------------------------------------------------------------------------------------------]  4% est:13s 
 plot: [1,11] [====>------------------------------------------------------------------------------------------------------]  5% est:15s 
 plot: [1,12] [=====>-----------------------------------------------------------------------------------------------------]  5% est:14s 
 plot: [1,13] [=====>-----------------------------------------------------------------------------------------------------]  6% est:14s 
 plot: [1,14] [======>----------------------------------------------------------------------------------------------------]  6% est:14s 
 plot: [1,15] [======>----------------------------------------------------------------------------------------------------]  7% est:14s 
 plot: [2,1] [=======>----------------------------------------------------------------------------------------------------]  7% est:13s 
 plot: [2,2] [=======>----------------------------------------------------------------------------------------------------]  8% est:13s 
 plot: [2,3] [========>---------------------------------------------------------------------------------------------------]  8% est:13s 
 plot: [2,4] [========>---------------------------------------------------------------------------------------------------]  8% est:13s 
 plot: [2,5] [=========>--------------------------------------------------------------------------------------------------]  9% est:13s 
 plot: [2,6] [=========>--------------------------------------------------------------------------------------------------]  9% est:13s 
 plot: [2,7] [==========>-------------------------------------------------------------------------------------------------] 10% est:13s 
 plot: [2,8] [==========>-------------------------------------------------------------------------------------------------] 10% est:12s 
 plot: [2,9] [===========>------------------------------------------------------------------------------------------------] 11% est:12s 
 plot: [2,10] [===========>-----------------------------------------------------------------------------------------------] 11% est:12s 
 plot: [2,11] [===========>-----------------------------------------------------------------------------------------------] 12% est:13s 
 plot: [2,12] [============>----------------------------------------------------------------------------------------------] 12% est:13s 
 plot: [2,13] [============>----------------------------------------------------------------------------------------------] 12% est:13s 
 plot: [2,14] [=============>---------------------------------------------------------------------------------------------] 13% est:12s 
 plot: [2,15] [=============>---------------------------------------------------------------------------------------------] 13% est:12s 
 plot: [3,1] [==============>---------------------------------------------------------------------------------------------] 14% est:12s 
 plot: [3,2] [==============>---------------------------------------------------------------------------------------------] 14% est:12s 
 plot: [3,3] [===============>--------------------------------------------------------------------------------------------] 15% est:12s 
 plot: [3,4] [===============>--------------------------------------------------------------------------------------------] 15% est:12s 
 plot: [3,5] [================>-------------------------------------------------------------------------------------------] 16% est:12s 
 plot: [3,6] [================>-------------------------------------------------------------------------------------------] 16% est:12s 
 plot: [3,7] [=================>------------------------------------------------------------------------------------------] 16% est:11s 
 plot: [3,8] [=================>------------------------------------------------------------------------------------------] 17% est:11s 
 plot: [3,9] [==================>-----------------------------------------------------------------------------------------] 17% est:12s 
 plot: [3,10] [==================>----------------------------------------------------------------------------------------] 18% est:12s 
 plot: [3,11] [==================>----------------------------------------------------------------------------------------] 18% est:12s 
 plot: [3,12] [===================>---------------------------------------------------------------------------------------] 19% est:12s 
 plot: [3,13] [===================>---------------------------------------------------------------------------------------] 19% est:11s 
 plot: [3,14] [====================>--------------------------------------------------------------------------------------] 20% est:11s 
 plot: [3,15] [====================>--------------------------------------------------------------------------------------] 20% est:11s 
 plot: [4,1] [=====================>--------------------------------------------------------------------------------------] 20% est:11s 
 plot: [4,2] [======================>-------------------------------------------------------------------------------------] 21% est:11s 
 plot: [4,3] [======================>-------------------------------------------------------------------------------------] 21% est:11s 
 plot: [4,4] [=======================>------------------------------------------------------------------------------------] 22% est:11s 
 plot: [4,5] [=======================>------------------------------------------------------------------------------------] 22% est:11s 
 plot: [4,6] [=======================>------------------------------------------------------------------------------------] 23% est:11s 
 plot: [4,7] [========================>-----------------------------------------------------------------------------------] 23% est:11s 
 plot: [4,8] [========================>-----------------------------------------------------------------------------------] 24% est:11s 
 plot: [4,9] [=========================>----------------------------------------------------------------------------------] 24% est:11s 
 plot: [4,10] [=========================>---------------------------------------------------------------------------------] 24% est:11s 
 plot: [4,11] [==========================>--------------------------------------------------------------------------------] 25% est:11s 
 plot: [4,12] [==========================>--------------------------------------------------------------------------------] 25% est:11s 
 plot: [4,13] [===========================>-------------------------------------------------------------------------------] 26% est:11s 
 plot: [4,14] [===========================>-------------------------------------------------------------------------------] 26% est:11s 
 plot: [4,15] [============================>------------------------------------------------------------------------------] 27% est:11s 
 plot: [5,1] [============================>-------------------------------------------------------------------------------] 27% est:11s 
 plot: [5,2] [=============================>------------------------------------------------------------------------------] 28% est:11s 
 plot: [5,3] [=============================>------------------------------------------------------------------------------] 28% est:10s 
 plot: [5,4] [==============================>-----------------------------------------------------------------------------] 28% est:10s 
 plot: [5,5] [==============================>-----------------------------------------------------------------------------] 29% est:10s 
 plot: [5,6] [===============================>----------------------------------------------------------------------------] 29% est:10s 
 plot: [5,7] [===============================>----------------------------------------------------------------------------] 30% est:10s 
 plot: [5,8] [================================>---------------------------------------------------------------------------] 30% est:10s 
 plot: [5,9] [================================>---------------------------------------------------------------------------] 31% est:10s 
 plot: [5,10] [================================>--------------------------------------------------------------------------] 31% est:10s 
 plot: [5,11] [=================================>-------------------------------------------------------------------------] 32% est:10s 
 plot: [5,12] [=================================>-------------------------------------------------------------------------] 32% est:10s 
 plot: [5,13] [==================================>------------------------------------------------------------------------] 32% est:10s 
 plot: [5,14] [==================================>------------------------------------------------------------------------] 33% est:10s 
 plot: [5,15] [===================================>-----------------------------------------------------------------------] 33% est:10s 
 plot: [6,1] [===================================>------------------------------------------------------------------------] 34% est:10s 
 plot: [6,2] [====================================>-----------------------------------------------------------------------] 34% est:10s 
 plot: [6,3] [====================================>-----------------------------------------------------------------------] 35% est: 9s 
 plot: [6,4] [=====================================>----------------------------------------------------------------------] 35% est: 9s 
 plot: [6,5] [=====================================>----------------------------------------------------------------------] 36% est: 9s 
 plot: [6,6] [======================================>---------------------------------------------------------------------] 36% est: 9s 
 plot: [6,7] [======================================>---------------------------------------------------------------------] 36% est: 9s 
 plot: [6,8] [=======================================>--------------------------------------------------------------------] 37% est: 9s 
 plot: [6,9] [=======================================>--------------------------------------------------------------------] 37% est: 9s 
 plot: [6,10] [=======================================>-------------------------------------------------------------------] 38% est: 9s 
 plot: [6,11] [========================================>------------------------------------------------------------------] 38% est: 9s 
 plot: [6,12] [========================================>------------------------------------------------------------------] 39% est: 9s 
 plot: [6,13] [=========================================>-----------------------------------------------------------------] 39% est: 9s 
 plot: [6,14] [=========================================>-----------------------------------------------------------------] 40% est: 9s 
 plot: [6,15] [==========================================>----------------------------------------------------------------] 40% est: 9s 
 plot: [7,1] [===========================================>----------------------------------------------------------------] 40% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,2] [===========================================>----------------------------------------------------------------] 41% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,3] [============================================>---------------------------------------------------------------] 41% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,4] [============================================>---------------------------------------------------------------] 42% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,5] [=============================================>--------------------------------------------------------------] 42% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,6] [=============================================>--------------------------------------------------------------] 43% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,7] [==============================================>-------------------------------------------------------------] 43% est: 9s 
 plot: [7,8] [==============================================>-------------------------------------------------------------] 44% est: 9s 
 plot: [7,9] [===============================================>------------------------------------------------------------] 44% est: 9s 
 plot: [7,10] [===============================================>-----------------------------------------------------------] 44% est: 9s 
 plot: [7,11] [===============================================>-----------------------------------------------------------] 45% est: 8s 
 plot: [7,12] [================================================>----------------------------------------------------------] 45% est: 8s 
 plot: [7,13] [================================================>----------------------------------------------------------] 46% est: 8s 
 plot: [7,14] [================================================>----------------------------------------------------------] 46% est: 8s 
 plot: [7,15] [=================================================>---------------------------------------------------------] 47% est: 8s 
 plot: [8,1] [==================================================>---------------------------------------------------------] 47% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,2] [==================================================>---------------------------------------------------------] 48% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,3] [===================================================>--------------------------------------------------------] 48% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,4] [===================================================>--------------------------------------------------------] 48% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,5] [====================================================>-------------------------------------------------------] 49% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,6] [====================================================>-------------------------------------------------------] 49% est: 9s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,7] [=====================================================>------------------------------------------------------] 50% est: 9s 
 plot: [8,8] [=====================================================>------------------------------------------------------] 50% est: 9s 
 plot: [8,9] [======================================================>-----------------------------------------------------] 51% est: 9s 
 plot: [8,10] [======================================================>----------------------------------------------------] 51% est: 9s 
 plot: [8,11] [======================================================>----------------------------------------------------] 52% est: 9s 
 plot: [8,12] [=======================================================>---------------------------------------------------] 52% est: 8s 
 plot: [8,13] [=======================================================>---------------------------------------------------] 52% est: 8s 
 plot: [8,14] [========================================================>--------------------------------------------------] 53% est: 8s 
 plot: [8,15] [========================================================>--------------------------------------------------] 53% est: 8s 
 plot: [9,1] [=========================================================>--------------------------------------------------] 54% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,2] [==========================================================>-------------------------------------------------] 54% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,3] [==========================================================>-------------------------------------------------] 55% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,4] [===========================================================>------------------------------------------------] 55% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,5] [===========================================================>------------------------------------------------] 56% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,6] [===========================================================>------------------------------------------------] 56% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,7] [============================================================>-----------------------------------------------] 56% est: 8s 
 plot: [9,8] [============================================================>-----------------------------------------------] 57% est: 8s 
 plot: [9,9] [=============================================================>----------------------------------------------] 57% est: 8s 
 plot: [9,10] [=============================================================>---------------------------------------------] 58% est: 8s 
 plot: [9,11] [=============================================================>---------------------------------------------] 58% est: 8s 
 plot: [9,12] [==============================================================>--------------------------------------------] 59% est: 8s 
 plot: [9,13] [==============================================================>--------------------------------------------] 59% est: 8s 
 plot: [9,14] [===============================================================>-------------------------------------------] 60% est: 8s 
 plot: [9,15] [===============================================================>-------------------------------------------] 60% est: 8s 
 plot: [10,1] [================================================================>------------------------------------------] 60% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,2] [================================================================>------------------------------------------] 61% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,3] [=================================================================>-----------------------------------------] 61% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,4] [=================================================================>-----------------------------------------] 62% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,5] [==================================================================>----------------------------------------] 62% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,6] [==================================================================>----------------------------------------] 63% est: 8s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,7] [===================================================================>---------------------------------------] 63% est: 8s 
 plot: [10,8] [===================================================================>---------------------------------------] 64% est: 8s 
 plot: [10,9] [===================================================================>---------------------------------------] 64% est: 8s 
 plot: [10,10] [===================================================================>--------------------------------------] 64% est: 8s 
 plot: [10,11] [====================================================================>-------------------------------------] 65% est: 8s 
 plot: [10,12] [====================================================================>-------------------------------------] 65% est: 8s 
 plot: [10,13] [=====================================================================>------------------------------------] 66% est: 8s 
 plot: [10,14] [=====================================================================>------------------------------------] 66% est: 8s 
 plot: [10,15] [======================================================================>-----------------------------------] 67% est: 8s 
 plot: [11,1] [=======================================================================>-----------------------------------] 67% est: 8s 
 plot: [11,2] [=======================================================================>-----------------------------------] 68% est: 7s 
 plot: [11,3] [========================================================================>----------------------------------] 68% est: 7s 
 plot: [11,4] [========================================================================>----------------------------------] 68% est: 7s 
 plot: [11,5] [=========================================================================>---------------------------------] 69% est: 7s 
 plot: [11,6] [=========================================================================>---------------------------------] 69% est: 7s 
 plot: [11,7] [==========================================================================>--------------------------------] 70% est: 7s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,8] [==========================================================================>--------------------------------] 70% est: 7s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,9] [===========================================================================>-------------------------------] 71% est: 7s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,10] [==========================================================================>-------------------------------] 71% est: 7s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,11] [===========================================================================>------------------------------] 72% est: 7s 
 plot: [11,12] [===========================================================================>------------------------------] 72% est: 7s 
 plot: [11,13] [============================================================================>-----------------------------] 72% est: 6s 
 plot: [11,14] [============================================================================>-----------------------------] 73% est: 6s 
 plot: [11,15] [=============================================================================>----------------------------] 73% est: 6s 
 plot: [12,1] [==============================================================================>----------------------------] 74% est: 6s 
 plot: [12,2] [==============================================================================>----------------------------] 74% est: 6s 
 plot: [12,3] [===============================================================================>---------------------------] 75% est: 6s 
 plot: [12,4] [===============================================================================>---------------------------] 75% est: 6s 
 plot: [12,5] [================================================================================>--------------------------] 76% est: 6s 
 plot: [12,6] [================================================================================>--------------------------] 76% est: 6s 
 plot: [12,7] [=================================================================================>-------------------------] 76% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,8] [=================================================================================>-------------------------] 77% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,9] [==================================================================================>------------------------] 77% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,10] [=================================================================================>------------------------] 78% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,11] [==================================================================================>-----------------------] 78% est: 5s 
 plot: [12,12] [==================================================================================>-----------------------] 79% est: 5s 
 plot: [12,13] [===================================================================================>----------------------] 79% est: 5s 
 plot: [12,14] [===================================================================================>----------------------] 80% est: 5s 
 plot: [12,15] [====================================================================================>---------------------] 80% est: 5s 
 plot: [13,1] [=====================================================================================>---------------------] 80% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,2] [======================================================================================>--------------------] 81% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,3] [======================================================================================>--------------------] 81% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,4] [=======================================================================================>-------------------] 82% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,5] [=======================================================================================>-------------------] 82% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,6] [=======================================================================================>-------------------] 83% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,7] [========================================================================================>------------------] 83% est: 4s 
 plot: [13,8] [========================================================================================>------------------] 84% est: 4s 
 plot: [13,9] [=========================================================================================>-----------------] 84% est: 4s 
 plot: [13,10] [=========================================================================================>----------------] 84% est: 4s 
 plot: [13,11] [=========================================================================================>----------------] 85% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,12] [=========================================================================================>----------------] 85% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,13] [==========================================================================================>---------------] 86% est: 3s 
 plot: [13,14] [==========================================================================================>---------------] 86% est: 3s 
 plot: [13,15] [===========================================================================================>--------------] 87% est: 3s 
 plot: [14,1] [============================================================================================>--------------] 87% est: 3s 
 plot: [14,2] [=============================================================================================>-------------] 88% est: 3s 
 plot: [14,3] [=============================================================================================>-------------] 88% est: 3s 
 plot: [14,4] [==============================================================================================>------------] 88% est: 3s 
 plot: [14,5] [==============================================================================================>------------] 89% est: 3s 
 plot: [14,6] [===============================================================================================>-----------] 89% est: 2s 
 plot: [14,7] [===============================================================================================>-----------] 90% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,8] [================================================================================================>----------] 90% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,9] [================================================================================================>----------] 91% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,10] [================================================================================================>---------] 91% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,11] [================================================================================================>---------] 92% est: 2s 
 plot: [14,12] [=================================================================================================>--------] 92% est: 2s 
 plot: [14,13] [=================================================================================================>--------] 92% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,14] [=================================================================================================>--------] 93% est: 2s 
 plot: [14,15] [==================================================================================================>-------] 93% est: 2s 
 plot: [15,1] [===================================================================================================>-------] 94% est: 1s 
 plot: [15,2] [====================================================================================================>------] 94% est: 1s 
 plot: [15,3] [====================================================================================================>------] 95% est: 1s 
 plot: [15,4] [=====================================================================================================>-----] 95% est: 1s 
 plot: [15,5] [=====================================================================================================>-----] 96% est: 1s 
 plot: [15,6] [======================================================================================================>----] 96% est: 1s 
 plot: [15,7] [======================================================================================================>----] 96% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [15,8] [=======================================================================================================>---] 97% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [15,9] [=======================================================================================================>---] 97% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [15,10] [=======================================================================================================>--] 98% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [15,11] [=======================================================================================================>--] 98% est: 0s 
 plot: [15,12] [========================================================================================================>-] 99% est: 0s 
 plot: [15,13] [========================================================================================================>-] 99% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [15,14] [=========================================================================================================>]100% est: 0s 
 plot: [15,15] [==========================================================================================================]100% est: 0s 
                                                                                                                                        

  • waterfront
  • grade
  • condition

Second predictor

mod2a1 <- lm(ln_price ~ sqft_living + lat,
             data = house)

summary(mod2a1)

Call:
lm(formula = ln_price ~ sqft_living + lat, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-3.00396 -0.19459 -0.01122  0.18293  1.24316 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -6.256e+01  7.239e-01  -86.42   <2e-16 ***
sqft_living  3.863e-04  2.297e-06  168.17   <2e-16 ***
lat          1.573e+00  1.522e-02  103.31   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3097 on 21610 degrees of freedom
Multiple R-squared:  0.6542,    Adjusted R-squared:  0.6542 
F-statistic: 2.045e+04 on 2 and 21610 DF,  p-value: < 2.2e-16
autoplot(mod2a1)

mod2a2 <- lm(price ~ sqft_living + lat,
             data = house)

summary(mod2a2)

Call:
lm(formula = price ~ sqft_living + lat, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1487994  -125643   -20309    84613  4368717 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -3.416e+07  5.653e+05  -60.44   <2e-16 ***
sqft_living  2.749e+02  1.794e+00  153.27   <2e-16 ***
lat          7.177e+05  1.189e+04   60.36   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 241900 on 21610 degrees of freedom
Multiple R-squared:  0.566, Adjusted R-squared:  0.566 
F-statistic: 1.409e+04 on 2 and 21610 DF,  p-value: < 2.2e-16
autoplot(mod2a2)

mod2b1 <- lm(ln_price ~ sqft_living + waterfront,
             data = house)

summary(mod2b1)

Call:
lm(formula = ln_price ~ sqft_living + waterfront, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.90243 -0.28303  0.01682  0.26106  1.27143 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
(Intercept)    1.223e+01  6.320e-03 1934.61   <2e-16 ***
sqft_living    3.926e-04  2.790e-06  140.73   <2e-16 ***
waterfrontTRUE 6.301e-01  2.961e-02   21.28   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3746 on 21610 degrees of freedom
Multiple R-squared:  0.4941,    Adjusted R-squared:  0.4941 
F-statistic: 1.055e+04 on 2 and 21610 DF,  p-value: < 2.2e-16
autoplot(mod2b1)

mod2b2 <- lm(price ~ sqft_living + waterfront,
             data = house)

summary(mod2b2)

Call:
lm(formula = price ~ sqft_living + waterfront, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1376782  -142867   -21360   107201  4449253 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)    -32957.851   4242.971  -7.768 8.35e-15 ***
sqft_living       272.507      1.873 145.499  < 2e-16 ***
waterfrontTRUE 829983.104  19882.279  41.745  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 251500 on 21610 degrees of freedom
Multiple R-squared:  0.5307,    Adjusted R-squared:  0.5307 
F-statistic: 1.222e+04 on 2 and 21610 DF,  p-value: < 2.2e-16
autoplot(mod2b2)

mod2c1 <- lm(ln_price ~ sqft_living + grade,
             data = house)

summary(mod2c1)

Call:
lm(formula = ln_price ~ sqft_living + grade, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.63935 -0.25462 -0.00143  0.23511  1.41830 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.259e+01  3.700e-02 340.222   <2e-16 ***
sqft_living  2.194e-04  4.110e-06  53.370   <2e-16 ***
grade.L      1.846e+00  1.880e-01   9.819   <2e-16 ***
grade.Q      5.663e-02  1.891e-01   0.300    0.765    
grade.C     -1.518e-01  1.692e-01  -0.897    0.370    
grade^4     -4.596e-02  1.502e-01  -0.306    0.760    
grade^5      5.557e-02  1.339e-01   0.415    0.678    
grade^6     -3.328e-02  1.135e-01  -0.293    0.769    
grade^7     -2.024e-03  8.778e-02  -0.023    0.982    
grade^8     -3.063e-03  6.092e-02  -0.050    0.960    
grade^9     -2.060e-02  3.753e-02  -0.549    0.583    
grade^10     1.083e-02  2.010e-02   0.539    0.590    
grade^11    -1.707e-03  8.825e-03  -0.193    0.847    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3511 on 21600 degrees of freedom
Multiple R-squared:  0.5559,    Adjusted R-squared:  0.5557 
F-statistic:  2253 on 12 and 21600 DF,  p-value: < 2.2e-16
autoplot(mod2c1)
Warning: Removed 1228 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

anova(mod1a1, mod2c1)
Analysis of Variance Table

Model 1: ln_price ~ sqft_living
Model 2: ln_price ~ sqft_living + grade
  Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
1  21611 3096.5                                  
2  21600 2662.4 11    434.12 320.18 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
mod2c2 <- lm(price ~ sqft_living + grade,
             data = house)

summary(mod2c2)

Call:
lm(formula = price ~ sqft_living + grade, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1550528  -129352   -27914    92324  4677732 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  5.310e+05  2.503e+04  21.214  < 2e-16 ***
sqft_living  1.573e+02  2.781e+00  56.567  < 2e-16 ***
grade.L      1.900e+06  1.272e+05  14.938  < 2e-16 ***
grade.Q      1.339e+06  1.279e+05  10.466  < 2e-16 ***
grade.C      6.572e+05  1.145e+05   5.740 9.57e-09 ***
grade^4      2.713e+05  1.016e+05   2.671  0.00758 ** 
grade^5      1.508e+05  9.058e+04   1.665  0.09593 .  
grade^6      6.872e+04  7.679e+04   0.895  0.37083    
grade^7      3.007e+04  5.939e+04   0.506  0.61262    
grade^8      5.303e+03  4.121e+04   0.129  0.89761    
grade^9     -9.327e+03  2.539e+04  -0.367  0.71339    
grade^10     5.547e+03  1.360e+04   0.408  0.68327    
grade^11    -3.506e+03  5.971e+03  -0.587  0.55708    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 237500 on 21600 degrees of freedom
Multiple R-squared:  0.5817,    Adjusted R-squared:  0.5814 
F-statistic:  2503 on 12 and 21600 DF,  p-value: < 2.2e-16
autoplot(mod2c2)
Warning: Removed 4665 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

anova(mod1a2, mod2c2)
Analysis of Variance Table

Model 1: price ~ sqft_living
Model 2: price ~ sqft_living + grade
  Res.Df        RSS Df  Sum of Sq      F    Pr(>F)    
1  21611 1.4773e+15                                   
2  21600 1.2186e+15 11 2.5871e+14 416.89 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
mod2d1 <- lm(ln_price ~ sqft_living + condition,
             data = house)

summary(mod2d1)

Call:
lm(formula = ln_price ~ sqft_living + condition, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.96468 -0.28308  0.01632  0.25785  1.45271 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.215e+01  1.580e-02 769.081  < 2e-16 ***
sqft_living  3.993e-04  2.802e-06 142.469  < 2e-16 ***
condition.L  2.997e-01  4.475e-02   6.697 2.19e-11 ***
condition.Q  2.876e-02  3.783e-02   0.760   0.4472    
condition.C -5.404e-02  2.858e-02  -1.891   0.0586 .  
condition^4  8.532e-02  1.636e-02   5.217 1.84e-07 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3756 on 21607 degrees of freedom
Multiple R-squared:  0.4915,    Adjusted R-squared:  0.4914 
F-statistic:  4177 on 5 and 21607 DF,  p-value: < 2.2e-16
autoplot(mod2d1)

mod2d2 <- lm(price ~ sqft_living + grade,
             data = house)

summary(mod2d2)

Call:
lm(formula = price ~ sqft_living + grade, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1550528  -129352   -27914    92324  4677732 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  5.310e+05  2.503e+04  21.214  < 2e-16 ***
sqft_living  1.573e+02  2.781e+00  56.567  < 2e-16 ***
grade.L      1.900e+06  1.272e+05  14.938  < 2e-16 ***
grade.Q      1.339e+06  1.279e+05  10.466  < 2e-16 ***
grade.C      6.572e+05  1.145e+05   5.740 9.57e-09 ***
grade^4      2.713e+05  1.016e+05   2.671  0.00758 ** 
grade^5      1.508e+05  9.058e+04   1.665  0.09593 .  
grade^6      6.872e+04  7.679e+04   0.895  0.37083    
grade^7      3.007e+04  5.939e+04   0.506  0.61262    
grade^8      5.303e+03  4.121e+04   0.129  0.89761    
grade^9     -9.327e+03  2.539e+04  -0.367  0.71339    
grade^10     5.547e+03  1.360e+04   0.408  0.68327    
grade^11    -3.506e+03  5.971e+03  -0.587  0.55708    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 237500 on 21600 degrees of freedom
Multiple R-squared:  0.5817,    Adjusted R-squared:  0.5814 
F-statistic:  2503 on 12 and 21600 DF,  p-value: < 2.2e-16
autoplot(mod2d2)
Warning: Removed 4665 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

Choose lat as second predictor

house_resid_numeric <- house_numeric %>% 
  add_residuals(mod2a1) %>% 
  select(-c(ln_price, sqft_living, lat))

house_resid_numeric %>% 
  select(resid, everything()) %>% 
  ggpairs()

 plot: [1,1] [>-----------------------------------------------------------------------------------------------------------]  1% est: 0s 
 plot: [1,2] [==>---------------------------------------------------------------------------------------------------------]  2% est: 3s 
 plot: [1,3] [===>--------------------------------------------------------------------------------------------------------]  4% est: 3s 
 plot: [1,4] [====>-------------------------------------------------------------------------------------------------------]  5% est: 3s 
 plot: [1,5] [======>-----------------------------------------------------------------------------------------------------]  6% est: 3s 
 plot: [1,6] [=======>----------------------------------------------------------------------------------------------------]  7% est: 3s 
 plot: [1,7] [========>---------------------------------------------------------------------------------------------------]  9% est: 3s 
 plot: [1,8] [==========>-------------------------------------------------------------------------------------------------] 10% est: 3s 
 plot: [1,9] [===========>------------------------------------------------------------------------------------------------] 11% est: 3s 
 plot: [2,1] [============>-----------------------------------------------------------------------------------------------] 12% est: 3s 
 plot: [2,2] [==============>---------------------------------------------------------------------------------------------] 14% est: 4s 
 plot: [2,3] [===============>--------------------------------------------------------------------------------------------] 15% est: 3s 
 plot: [2,4] [================>-------------------------------------------------------------------------------------------] 16% est: 3s 
 plot: [2,5] [==================>-----------------------------------------------------------------------------------------] 17% est: 3s 
 plot: [2,6] [===================>----------------------------------------------------------------------------------------] 19% est: 3s 
 plot: [2,7] [====================>---------------------------------------------------------------------------------------] 20% est: 3s 
 plot: [2,8] [======================>-------------------------------------------------------------------------------------] 21% est: 3s 
 plot: [2,9] [=======================>------------------------------------------------------------------------------------] 22% est: 3s 
 plot: [3,1] [========================>-----------------------------------------------------------------------------------] 23% est: 3s 
 plot: [3,2] [==========================>---------------------------------------------------------------------------------] 25% est: 3s 
 plot: [3,3] [===========================>--------------------------------------------------------------------------------] 26% est: 3s 
 plot: [3,4] [============================>-------------------------------------------------------------------------------] 27% est: 3s 
 plot: [3,5] [==============================>-----------------------------------------------------------------------------] 28% est: 3s 
 plot: [3,6] [===============================>----------------------------------------------------------------------------] 30% est: 3s 
 plot: [3,7] [================================>---------------------------------------------------------------------------] 31% est: 3s 
 plot: [3,8] [==================================>-------------------------------------------------------------------------] 32% est: 3s 
 plot: [3,9] [===================================>------------------------------------------------------------------------] 33% est: 3s 
 plot: [4,1] [====================================>-----------------------------------------------------------------------] 35% est: 3s 
 plot: [4,2] [======================================>---------------------------------------------------------------------] 36% est: 3s 
 plot: [4,3] [=======================================>--------------------------------------------------------------------] 37% est: 3s 
 plot: [4,4] [========================================>-------------------------------------------------------------------] 38% est: 3s 
 plot: [4,5] [==========================================>-----------------------------------------------------------------] 40% est: 3s 
 plot: [4,6] [===========================================>----------------------------------------------------------------] 41% est: 3s 
 plot: [4,7] [============================================>---------------------------------------------------------------] 42% est: 3s 
 plot: [4,8] [==============================================>-------------------------------------------------------------] 43% est: 2s 
 plot: [4,9] [===============================================>------------------------------------------------------------] 44% est: 2s 
 plot: [5,1] [================================================>-----------------------------------------------------------] 46% est: 2s 
 plot: [5,2] [==================================================>---------------------------------------------------------] 47% est: 2s 
 plot: [5,3] [===================================================>--------------------------------------------------------] 48% est: 2s 
 plot: [5,4] [====================================================>-------------------------------------------------------] 49% est: 2s 
 plot: [5,5] [======================================================>-----------------------------------------------------] 51% est: 2s 
 plot: [5,6] [=======================================================>----------------------------------------------------] 52% est: 2s 
 plot: [5,7] [========================================================>---------------------------------------------------] 53% est: 2s 
 plot: [5,8] [==========================================================>-------------------------------------------------] 54% est: 2s 
 plot: [5,9] [===========================================================>------------------------------------------------] 56% est: 2s 
 plot: [6,1] [============================================================>-----------------------------------------------] 57% est: 2s 
 plot: [6,2] [==============================================================>---------------------------------------------] 58% est: 2s 
 plot: [6,3] [===============================================================>--------------------------------------------] 59% est: 2s 
 plot: [6,4] [================================================================>-------------------------------------------] 60% est: 2s 
 plot: [6,5] [==================================================================>-----------------------------------------] 62% est: 2s 
 plot: [6,6] [===================================================================>----------------------------------------] 63% est: 2s 
 plot: [6,7] [====================================================================>---------------------------------------] 64% est: 2s 
 plot: [6,8] [======================================================================>-------------------------------------] 65% est: 2s 
 plot: [6,9] [=======================================================================>------------------------------------] 67% est: 1s 
 plot: [7,1] [========================================================================>-----------------------------------] 68% est: 1s 
 plot: [7,2] [==========================================================================>---------------------------------] 69% est: 1s 
 plot: [7,3] [===========================================================================>--------------------------------] 70% est: 1s 
 plot: [7,4] [============================================================================>-------------------------------] 72% est: 1s 
 plot: [7,5] [==============================================================================>-----------------------------] 73% est: 1s 
 plot: [7,6] [===============================================================================>----------------------------] 74% est: 1s 
 plot: [7,7] [================================================================================>---------------------------] 75% est: 1s 
 plot: [7,8] [==================================================================================>-------------------------] 77% est: 1s 
 plot: [7,9] [===================================================================================>------------------------] 78% est: 1s 
 plot: [8,1] [====================================================================================>-----------------------] 79% est: 1s 
 plot: [8,2] [======================================================================================>---------------------] 80% est: 1s 
 plot: [8,3] [=======================================================================================>--------------------] 81% est: 1s 
 plot: [8,4] [========================================================================================>-------------------] 83% est: 1s 
 plot: [8,5] [==========================================================================================>-----------------] 84% est: 1s 
 plot: [8,6] [===========================================================================================>----------------] 85% est: 1s 
 plot: [8,7] [============================================================================================>---------------] 86% est: 1s 
 plot: [8,8] [==============================================================================================>-------------] 88% est: 1s 
 plot: [8,9] [===============================================================================================>------------] 89% est: 1s 
 plot: [9,1] [================================================================================================>-----------] 90% est: 0s 
 plot: [9,2] [==================================================================================================>---------] 91% est: 0s 
 plot: [9,3] [===================================================================================================>--------] 93% est: 0s 
 plot: [9,4] [====================================================================================================>-------] 94% est: 0s 
 plot: [9,5] [======================================================================================================>-----] 95% est: 0s 
 plot: [9,6] [=======================================================================================================>----] 96% est: 0s 
 plot: [9,7] [========================================================================================================>---] 98% est: 0s 
 plot: [9,8] [==========================================================================================================>-] 99% est: 0s 
 plot: [9,9] [============================================================================================================]100% est: 0s 
                                                                                                                                        

  • yr_built
house_resid <- house %>% 
  add_residuals(mod2a1) %>% 
  select(-c(ln_price, sqft_living, lat))

house_resid %>% 
  select(resid, everything()) %>% 
  ggpairs()

 plot: [1,1] [>-----------------------------------------------------------------------------------------------------------]  1% est: 0s 
 plot: [1,2] [>-----------------------------------------------------------------------------------------------------------]  1% est: 7s 
 plot: [1,3] [=>----------------------------------------------------------------------------------------------------------]  2% est: 8s 
 plot: [1,4] [=>----------------------------------------------------------------------------------------------------------]  2% est: 8s 
 plot: [1,5] [==>---------------------------------------------------------------------------------------------------------]  3% est: 8s 
 plot: [1,6] [==>---------------------------------------------------------------------------------------------------------]  3% est: 9s 
 plot: [1,7] [===>--------------------------------------------------------------------------------------------------------]  4% est: 9s 
 plot: [1,8] [===>--------------------------------------------------------------------------------------------------------]  4% est: 9s 
 plot: [1,9] [====>-------------------------------------------------------------------------------------------------------]  5% est:10s 
 plot: [1,10] [====>------------------------------------------------------------------------------------------------------]  5% est:10s 
 plot: [1,11] [=====>-----------------------------------------------------------------------------------------------------]  6% est:11s 
 plot: [1,12] [======>----------------------------------------------------------------------------------------------------]  6% est:10s 
 plot: [1,13] [======>----------------------------------------------------------------------------------------------------]  7% est:10s 
 plot: [1,14] [=======>---------------------------------------------------------------------------------------------------]  7% est:10s 
 plot: [2,1] [=======>----------------------------------------------------------------------------------------------------]  8% est:10s 
 plot: [2,2] [========>---------------------------------------------------------------------------------------------------]  8% est:10s 
 plot: [2,3] [========>---------------------------------------------------------------------------------------------------]  9% est:10s 
 plot: [2,4] [=========>--------------------------------------------------------------------------------------------------]  9% est:10s 
 plot: [2,5] [=========>--------------------------------------------------------------------------------------------------] 10% est:10s 
 plot: [2,6] [==========>-------------------------------------------------------------------------------------------------] 10% est:10s 
 plot: [2,7] [===========>------------------------------------------------------------------------------------------------] 11% est:10s 
 plot: [2,8] [===========>------------------------------------------------------------------------------------------------] 11% est: 9s 
 plot: [2,9] [============>-----------------------------------------------------------------------------------------------] 12% est: 9s 
 plot: [2,10] [============>----------------------------------------------------------------------------------------------] 12% est:10s 
 plot: [2,11] [=============>---------------------------------------------------------------------------------------------] 13% est:10s 
 plot: [2,12] [=============>---------------------------------------------------------------------------------------------] 13% est:10s 
 plot: [2,13] [==============>--------------------------------------------------------------------------------------------] 14% est:10s 
 plot: [2,14] [==============>--------------------------------------------------------------------------------------------] 14% est:10s 
 plot: [3,1] [===============>--------------------------------------------------------------------------------------------] 15% est: 9s 
 plot: [3,2] [================>-------------------------------------------------------------------------------------------] 15% est: 9s 
 plot: [3,3] [================>-------------------------------------------------------------------------------------------] 16% est: 9s 
 plot: [3,4] [=================>------------------------------------------------------------------------------------------] 16% est: 9s 
 plot: [3,5] [=================>------------------------------------------------------------------------------------------] 17% est: 9s 
 plot: [3,6] [==================>-----------------------------------------------------------------------------------------] 17% est: 9s 
 plot: [3,7] [==================>-----------------------------------------------------------------------------------------] 18% est: 9s 
 plot: [3,8] [===================>----------------------------------------------------------------------------------------] 18% est: 9s 
 plot: [3,9] [===================>----------------------------------------------------------------------------------------] 19% est: 9s 
 plot: [3,10] [====================>--------------------------------------------------------------------------------------] 19% est: 9s 
 plot: [3,11] [====================>--------------------------------------------------------------------------------------] 20% est: 9s 
 plot: [3,12] [=====================>-------------------------------------------------------------------------------------] 20% est: 9s 
 plot: [3,13] [=====================>-------------------------------------------------------------------------------------] 21% est: 9s 
 plot: [3,14] [======================>------------------------------------------------------------------------------------] 21% est: 9s 
 plot: [4,1] [=======================>------------------------------------------------------------------------------------] 22% est: 9s 
 plot: [4,2] [=======================>------------------------------------------------------------------------------------] 22% est: 9s 
 plot: [4,3] [========================>-----------------------------------------------------------------------------------] 23% est: 9s 
 plot: [4,4] [========================>-----------------------------------------------------------------------------------] 23% est: 9s 
 plot: [4,5] [=========================>----------------------------------------------------------------------------------] 24% est: 8s 
 plot: [4,6] [=========================>----------------------------------------------------------------------------------] 24% est: 8s 
 plot: [4,7] [==========================>---------------------------------------------------------------------------------] 25% est: 8s 
 plot: [4,8] [===========================>--------------------------------------------------------------------------------] 26% est: 8s 
 plot: [4,9] [===========================>--------------------------------------------------------------------------------] 26% est: 8s 
 plot: [4,10] [===========================>-------------------------------------------------------------------------------] 27% est: 8s 
 plot: [4,11] [============================>------------------------------------------------------------------------------] 27% est: 8s 
 plot: [4,12] [============================>------------------------------------------------------------------------------] 28% est: 8s 
 plot: [4,13] [=============================>-----------------------------------------------------------------------------] 28% est: 8s 
 plot: [4,14] [==============================>----------------------------------------------------------------------------] 29% est: 8s 
 plot: [5,1] [==============================>-----------------------------------------------------------------------------] 29% est: 8s 
 plot: [5,2] [===============================>----------------------------------------------------------------------------] 30% est: 8s 
 plot: [5,3] [================================>---------------------------------------------------------------------------] 30% est: 8s 
 plot: [5,4] [================================>---------------------------------------------------------------------------] 31% est: 8s 
 plot: [5,5] [=================================>--------------------------------------------------------------------------] 31% est: 8s 
 plot: [5,6] [=================================>--------------------------------------------------------------------------] 32% est: 8s 
 plot: [5,7] [==================================>-------------------------------------------------------------------------] 32% est: 8s 
 plot: [5,8] [==================================>-------------------------------------------------------------------------] 33% est: 7s 
 plot: [5,9] [===================================>------------------------------------------------------------------------] 33% est: 7s 
 plot: [5,10] [===================================>-----------------------------------------------------------------------] 34% est: 7s 
 plot: [5,11] [====================================>----------------------------------------------------------------------] 34% est: 7s 
 plot: [5,12] [====================================>----------------------------------------------------------------------] 35% est: 7s 
 plot: [5,13] [=====================================>---------------------------------------------------------------------] 35% est: 7s 
 plot: [5,14] [=====================================>---------------------------------------------------------------------] 36% est: 7s 
 plot: [6,1] [======================================>---------------------------------------------------------------------] 36% est: 7s 
 plot: [6,2] [=======================================>--------------------------------------------------------------------] 37% est: 7s 
 plot: [6,3] [=======================================>--------------------------------------------------------------------] 37% est: 7s 
 plot: [6,4] [========================================>-------------------------------------------------------------------] 38% est: 7s 
 plot: [6,5] [========================================>-------------------------------------------------------------------] 38% est: 7s 
 plot: [6,6] [=========================================>------------------------------------------------------------------] 39% est: 7s 
 plot: [6,7] [=========================================>------------------------------------------------------------------] 39% est: 7s 
 plot: [6,8] [==========================================>-----------------------------------------------------------------] 40% est: 7s 
 plot: [6,9] [===========================================>----------------------------------------------------------------] 40% est: 7s 
 plot: [6,10] [===========================================>---------------------------------------------------------------] 41% est: 7s 
 plot: [6,11] [===========================================>---------------------------------------------------------------] 41% est: 7s 
 plot: [6,12] [============================================>--------------------------------------------------------------] 42% est: 7s 
 plot: [6,13] [============================================>--------------------------------------------------------------] 42% est: 7s 
 plot: [6,14] [=============================================>-------------------------------------------------------------] 43% est: 6s 
 plot: [7,1] [==============================================>-------------------------------------------------------------] 43% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,2] [==============================================>-------------------------------------------------------------] 44% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,3] [===============================================>------------------------------------------------------------] 44% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,4] [===============================================>------------------------------------------------------------] 45% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,5] [================================================>-----------------------------------------------------------] 45% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,6] [=================================================>----------------------------------------------------------] 46% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,7] [=================================================>----------------------------------------------------------] 46% est: 6s 
 plot: [7,8] [==================================================>---------------------------------------------------------] 47% est: 6s 
 plot: [7,9] [==================================================>---------------------------------------------------------] 47% est: 6s 
 plot: [7,10] [==================================================>--------------------------------------------------------] 48% est: 6s 
 plot: [7,11] [===================================================>-------------------------------------------------------] 48% est: 6s 
 plot: [7,12] [===================================================>-------------------------------------------------------] 49% est: 6s 
 plot: [7,13] [====================================================>------------------------------------------------------] 49% est: 6s 
 plot: [7,14] [=====================================================>-----------------------------------------------------] 50% est: 6s 
 plot: [8,1] [======================================================>-----------------------------------------------------] 51% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,2] [======================================================>-----------------------------------------------------] 51% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,3] [=======================================================>----------------------------------------------------] 52% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,4] [=======================================================>----------------------------------------------------] 52% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,5] [========================================================>---------------------------------------------------] 53% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,6] [========================================================>---------------------------------------------------] 53% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,7] [=========================================================>--------------------------------------------------] 54% est: 6s 
 plot: [8,8] [=========================================================>--------------------------------------------------] 54% est: 6s 
 plot: [8,9] [==========================================================>-------------------------------------------------] 55% est: 6s 
 plot: [8,10] [==========================================================>------------------------------------------------] 55% est: 6s 
 plot: [8,11] [===========================================================>-----------------------------------------------] 56% est: 6s 
 plot: [8,12] [===========================================================>-----------------------------------------------] 56% est: 6s 
 plot: [8,13] [============================================================>----------------------------------------------] 57% est: 6s 
 plot: [8,14] [============================================================>----------------------------------------------] 57% est: 6s 
 plot: [9,1] [=============================================================>----------------------------------------------] 58% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,2] [==============================================================>---------------------------------------------] 58% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,3] [==============================================================>---------------------------------------------] 59% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,4] [===============================================================>--------------------------------------------] 59% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,5] [===============================================================>--------------------------------------------] 60% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,6] [================================================================>-------------------------------------------] 60% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,7] [=================================================================>------------------------------------------] 61% est: 6s 
 plot: [9,8] [=================================================================>------------------------------------------] 61% est: 6s 
 plot: [9,9] [==================================================================>-----------------------------------------] 62% est: 6s 
 plot: [9,10] [==================================================================>----------------------------------------] 62% est: 6s 
 plot: [9,11] [==================================================================>----------------------------------------] 63% est: 6s 
 plot: [9,12] [===================================================================>---------------------------------------] 63% est: 5s 
 plot: [9,13] [===================================================================>---------------------------------------] 64% est: 5s 
 plot: [9,14] [====================================================================>--------------------------------------] 64% est: 5s 
 plot: [10,1] [====================================================================>--------------------------------------] 65% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,2] [=====================================================================>-------------------------------------] 65% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,3] [=====================================================================>-------------------------------------] 66% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,4] [======================================================================>------------------------------------] 66% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,5] [=======================================================================>-----------------------------------] 67% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,6] [=======================================================================>-----------------------------------] 67% est: 6s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,7] [========================================================================>----------------------------------] 68% est: 6s 
 plot: [10,8] [========================================================================>----------------------------------] 68% est: 6s 
 plot: [10,9] [=========================================================================>---------------------------------] 69% est: 6s 
 plot: [10,10] [=========================================================================>--------------------------------] 69% est: 6s 
 plot: [10,11] [=========================================================================>--------------------------------] 70% est: 6s 
 plot: [10,12] [==========================================================================>-------------------------------] 70% est: 5s 
 plot: [10,13] [==========================================================================>-------------------------------] 71% est: 5s 
 plot: [10,14] [===========================================================================>------------------------------] 71% est: 5s 
 plot: [11,1] [============================================================================>------------------------------] 72% est: 5s 
 plot: [11,2] [=============================================================================>-----------------------------] 72% est: 5s 
 plot: [11,3] [=============================================================================>-----------------------------] 73% est: 5s 
 plot: [11,4] [==============================================================================>----------------------------] 73% est: 5s 
 plot: [11,5] [==============================================================================>----------------------------] 74% est: 5s 
 plot: [11,6] [===============================================================================>---------------------------] 74% est: 5s 
 plot: [11,7] [===============================================================================>---------------------------] 75% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,8] [================================================================================>--------------------------] 76% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,9] [================================================================================>--------------------------] 76% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,10] [================================================================================>-------------------------] 77% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,11] [=================================================================================>------------------------] 77% est: 4s 
 plot: [11,12] [=================================================================================>------------------------] 78% est: 4s 
 plot: [11,13] [==================================================================================>-----------------------] 78% est: 4s 
 plot: [11,14] [==================================================================================>-----------------------] 79% est: 4s 
 plot: [12,1] [====================================================================================>----------------------] 79% est: 4s 
 plot: [12,2] [====================================================================================>----------------------] 80% est: 4s 
 plot: [12,3] [=====================================================================================>---------------------] 80% est: 4s 
 plot: [12,4] [=====================================================================================>---------------------] 81% est: 4s 
 plot: [12,5] [======================================================================================>--------------------] 81% est: 3s 
 plot: [12,6] [======================================================================================>--------------------] 82% est: 3s 
 plot: [12,7] [=======================================================================================>-------------------] 82% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,8] [=======================================================================================>-------------------] 83% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,9] [========================================================================================>------------------] 83% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,10] [========================================================================================>-----------------] 84% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,11] [========================================================================================>-----------------] 84% est: 3s 
 plot: [12,12] [=========================================================================================>----------------] 85% est: 3s 
 plot: [12,13] [=========================================================================================>----------------] 85% est: 3s 
 plot: [12,14] [==========================================================================================>---------------] 86% est: 3s 
 plot: [13,1] [===========================================================================================>---------------] 86% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,2] [============================================================================================>--------------] 87% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,3] [============================================================================================>--------------] 87% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,4] [=============================================================================================>-------------] 88% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,5] [=============================================================================================>-------------] 88% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,6] [==============================================================================================>------------] 89% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,7] [===============================================================================================>-----------] 89% est: 2s 
 plot: [13,8] [===============================================================================================>-----------] 90% est: 2s 
 plot: [13,9] [================================================================================================>----------] 90% est: 2s 
 plot: [13,10] [===============================================================================================>----------] 91% est: 2s 
 plot: [13,11] [================================================================================================>---------] 91% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,12] [================================================================================================>---------] 92% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,13] [=================================================================================================>--------] 92% est: 1s 
 plot: [13,14] [=================================================================================================>--------] 93% est: 1s 
 plot: [14,1] [===================================================================================================>-------] 93% est: 1s 
 plot: [14,2] [===================================================================================================>-------] 94% est: 1s 
 plot: [14,3] [====================================================================================================>------] 94% est: 1s 
 plot: [14,4] [=====================================================================================================>-----] 95% est: 1s 
 plot: [14,5] [=====================================================================================================>-----] 95% est: 1s 
 plot: [14,6] [======================================================================================================>----] 96% est: 1s 
 plot: [14,7] [======================================================================================================>----] 96% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,8] [=======================================================================================================>---] 97% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,9] [=======================================================================================================>---] 97% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,10] [=======================================================================================================>--] 98% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,11] [=======================================================================================================>--] 98% est: 0s 
 plot: [14,12] [========================================================================================================>-] 99% est: 0s 
 plot: [14,13] [========================================================================================================>-] 99% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [14,14] [==========================================================================================================]100% est: 0s 
                                                                                                                                        

  • grade
  • waterfront
  • condition

third predictor

mod3a1 <- lm(ln_price ~ sqft_living + lat + yr_built,
             data = house)

autoplot(mod3a1)


summary(mod3a1)

Call:
lm(formula = ln_price ~ sqft_living + lat + yr_built, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-3.13482 -0.19229 -0.00225  0.18551  1.27495 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -5.718e+01  7.686e-01  -74.40   <2e-16 ***
sqft_living  4.018e-04  2.412e-06  166.59   <2e-16 ***
lat          1.521e+00  1.533e-02   99.22   <2e-16 ***
yr_built    -1.487e-03  7.616e-05  -19.53   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.307 on 21609 degrees of freedom
Multiple R-squared:  0.6602,    Adjusted R-squared:  0.6602 
F-statistic: 1.4e+04 on 3 and 21609 DF,  p-value: < 2.2e-16
mod3b1 <- lm(ln_price ~ sqft_living + lat + grade,
             data = house)

autoplot(mod3b1)
Warning: Removed 2702 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

summary(mod3b1)

Call:
lm(formula = ln_price ~ sqft_living + lat + grade, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.88559 -0.18372 -0.01666  0.16834  1.33509 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -5.768e+01  6.752e-01 -85.417   <2e-16 ***
sqft_living  2.371e-04  3.358e-06  70.594   <2e-16 ***
lat          1.477e+00  1.418e-02 104.163   <2e-16 ***
grade.L      1.423e+00  1.534e-01   9.277   <2e-16 ***
grade.Q      3.446e-02  1.543e-01   0.223    0.823    
grade.C     -1.060e-01  1.381e-01  -0.768    0.443    
grade^4     -1.770e-01  1.225e-01  -1.444    0.149    
grade^5      1.556e-01  1.092e-01   1.424    0.154    
grade^6     -1.507e-01  9.261e-02  -1.627    0.104    
grade^7      6.952e-02  7.162e-02   0.971    0.332    
grade^8     -6.991e-02  4.970e-02  -1.407    0.160    
grade^9      1.601e-02  3.062e-02   0.523    0.601    
grade^10    -5.606e-03  1.640e-02  -0.342    0.732    
grade^11     3.512e-03  7.200e-03   0.488    0.626    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2864 on 21599 degrees of freedom
Multiple R-squared:  0.7044,    Adjusted R-squared:  0.7042 
F-statistic:  3959 on 13 and 21599 DF,  p-value: < 2.2e-16
anova(mod2a1, mod3b1)
Analysis of Variance Table

Model 1: ln_price ~ sqft_living + lat
Model 2: ln_price ~ sqft_living + lat + grade
  Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
1  21610 2072.8                                  
2  21599 1772.2 11    300.66 333.14 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
mod3c1 <- lm(ln_price ~ sqft_living + lat + waterfront,
             data = house)

autoplot(mod3c1)


summary(mod3c1)

Call:
lm(formula = ln_price ~ sqft_living + lat + waterfront, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.92268 -0.19151 -0.00763  0.18383  1.23200 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)    -6.295e+01  7.110e-01  -88.54   <2e-16 ***
sqft_living     3.796e-04  2.268e-06  167.35   <2e-16 ***
lat             1.581e+00  1.495e-02  105.74   <2e-16 ***
waterfrontTRUE  6.807e-01  2.405e-02   28.31   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3041 on 21609 degrees of freedom
Multiple R-squared:  0.6666,    Adjusted R-squared:  0.6666 
F-statistic: 1.44e+04 on 3 and 21609 DF,  p-value: < 2.2e-16
mod3d1 <- lm(ln_price ~ sqft_living + lat + condition,
             data = house)

autoplot(mod3d1)


summary(mod3d1)

Call:
lm(formula = ln_price ~ sqft_living + lat + condition, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.99914 -0.19553 -0.00896  0.18317  1.35340 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -6.269e+01  7.173e-01 -87.393   <2e-16 ***
sqft_living  3.880e-04  2.288e-06 169.615   <2e-16 ***
lat          1.574e+00  1.508e-02 104.352   <2e-16 ***
condition.L  3.015e-01  3.649e-02   8.261   <2e-16 ***
condition.Q -1.629e-02  3.085e-02  -0.528   0.5974    
condition.C -3.095e-02  2.330e-02  -1.328   0.1842    
condition^4  4.212e-02  1.334e-02   3.156   0.0016 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3063 on 21606 degrees of freedom
Multiple R-squared:  0.6619,    Adjusted R-squared:  0.6618 
F-statistic:  7050 on 6 and 21606 DF,  p-value: < 2.2e-16

choose grade

look at residuals

house_resid <- house %>% 
  add_residuals(mod3b1) %>% 
  select(-c(ln_price, sqft_living, lat, grade))

house_resid %>% 
  select(resid, everything()) %>% 
  ggpairs()

 plot: [1,1] [>-----------------------------------------------------------------------------------------------------------]  1% est: 0s 
 plot: [1,2] [>-----------------------------------------------------------------------------------------------------------]  1% est: 7s 
 plot: [1,3] [=>----------------------------------------------------------------------------------------------------------]  2% est: 8s 
 plot: [1,4] [==>---------------------------------------------------------------------------------------------------------]  2% est: 8s 
 plot: [1,5] [==>---------------------------------------------------------------------------------------------------------]  3% est: 8s 
 plot: [1,6] [===>--------------------------------------------------------------------------------------------------------]  4% est: 8s 
 plot: [1,7] [===>--------------------------------------------------------------------------------------------------------]  4% est: 8s 
 plot: [1,8] [====>-------------------------------------------------------------------------------------------------------]  5% est: 8s 
 plot: [1,9] [=====>------------------------------------------------------------------------------------------------------]  5% est: 8s 
 plot: [1,10] [=====>-----------------------------------------------------------------------------------------------------]  6% est: 9s 
 plot: [1,11] [======>----------------------------------------------------------------------------------------------------]  7% est: 9s 
 plot: [1,12] [=======>---------------------------------------------------------------------------------------------------]  7% est: 9s 
 plot: [1,13] [=======>---------------------------------------------------------------------------------------------------]  8% est: 9s 
 plot: [2,1] [========>---------------------------------------------------------------------------------------------------]  8% est: 9s 
 plot: [2,2] [=========>--------------------------------------------------------------------------------------------------]  9% est: 9s 
 plot: [2,3] [=========>--------------------------------------------------------------------------------------------------]  9% est: 9s 
 plot: [2,4] [==========>-------------------------------------------------------------------------------------------------] 10% est: 9s 
 plot: [2,5] [===========>------------------------------------------------------------------------------------------------] 11% est: 9s 
 plot: [2,6] [===========>------------------------------------------------------------------------------------------------] 11% est: 9s 
 plot: [2,7] [============>-----------------------------------------------------------------------------------------------] 12% est: 8s 
 plot: [2,8] [============>-----------------------------------------------------------------------------------------------] 12% est: 8s 
 plot: [2,9] [=============>----------------------------------------------------------------------------------------------] 13% est: 8s 
 plot: [2,10] [==============>--------------------------------------------------------------------------------------------] 14% est: 8s 
 plot: [2,11] [==============>--------------------------------------------------------------------------------------------] 14% est: 8s 
 plot: [2,12] [===============>-------------------------------------------------------------------------------------------] 15% est: 8s 
 plot: [2,13] [===============>-------------------------------------------------------------------------------------------] 15% est: 8s 
 plot: [3,1] [================>-------------------------------------------------------------------------------------------] 16% est: 8s 
 plot: [3,2] [=================>------------------------------------------------------------------------------------------] 17% est: 8s 
 plot: [3,3] [==================>-----------------------------------------------------------------------------------------] 17% est: 8s 
 plot: [3,4] [==================>-----------------------------------------------------------------------------------------] 18% est: 8s 
 plot: [3,5] [===================>----------------------------------------------------------------------------------------] 18% est: 8s 
 plot: [3,6] [===================>----------------------------------------------------------------------------------------] 19% est: 8s 
 plot: [3,7] [====================>---------------------------------------------------------------------------------------] 20% est: 8s 
 plot: [3,8] [=====================>--------------------------------------------------------------------------------------] 20% est: 8s 
 plot: [3,9] [=====================>--------------------------------------------------------------------------------------] 21% est: 8s 
 plot: [3,10] [======================>------------------------------------------------------------------------------------] 21% est: 8s 
 plot: [3,11] [======================>------------------------------------------------------------------------------------] 22% est: 8s 
 plot: [3,12] [=======================>-----------------------------------------------------------------------------------] 22% est: 8s 
 plot: [3,13] [========================>----------------------------------------------------------------------------------] 23% est: 8s 
 plot: [4,1] [=========================>----------------------------------------------------------------------------------] 24% est: 7s 
 plot: [4,2] [=========================>----------------------------------------------------------------------------------] 24% est: 7s 
 plot: [4,3] [==========================>---------------------------------------------------------------------------------] 25% est: 7s 
 plot: [4,4] [==========================>---------------------------------------------------------------------------------] 25% est: 7s 
 plot: [4,5] [===========================>--------------------------------------------------------------------------------] 26% est: 7s 
 plot: [4,6] [============================>-------------------------------------------------------------------------------] 27% est: 7s 
 plot: [4,7] [============================>-------------------------------------------------------------------------------] 27% est: 7s 
 plot: [4,8] [=============================>------------------------------------------------------------------------------] 28% est: 7s 
 plot: [4,9] [==============================>-----------------------------------------------------------------------------] 28% est: 7s 
 plot: [4,10] [==============================>----------------------------------------------------------------------------] 29% est: 7s 
 plot: [4,11] [===============================>---------------------------------------------------------------------------] 30% est: 7s 
 plot: [4,12] [===============================>---------------------------------------------------------------------------] 30% est: 7s 
 plot: [4,13] [================================>--------------------------------------------------------------------------] 31% est: 7s 
 plot: [5,1] [=================================>--------------------------------------------------------------------------] 31% est: 7s 
 plot: [5,2] [==================================>-------------------------------------------------------------------------] 32% est: 7s 
 plot: [5,3] [==================================>-------------------------------------------------------------------------] 33% est: 6s 
 plot: [5,4] [===================================>------------------------------------------------------------------------] 33% est: 6s 
 plot: [5,5] [===================================>------------------------------------------------------------------------] 34% est: 6s 
 plot: [5,6] [====================================>-----------------------------------------------------------------------] 34% est: 6s 
 plot: [5,7] [=====================================>----------------------------------------------------------------------] 35% est: 6s 
 plot: [5,8] [=====================================>----------------------------------------------------------------------] 36% est: 6s 
 plot: [5,9] [======================================>---------------------------------------------------------------------] 36% est: 6s 
 plot: [5,10] [======================================>--------------------------------------------------------------------] 37% est: 6s 
 plot: [5,11] [=======================================>-------------------------------------------------------------------] 37% est: 6s 
 plot: [5,12] [========================================>------------------------------------------------------------------] 38% est: 6s 
 plot: [5,13] [========================================>------------------------------------------------------------------] 38% est: 6s 
 plot: [6,1] [=========================================>------------------------------------------------------------------] 39% est: 6s 
 plot: [6,2] [==========================================>-----------------------------------------------------------------] 40% est: 6s 
 plot: [6,3] [==========================================>-----------------------------------------------------------------] 40% est: 6s 
 plot: [6,4] [===========================================>----------------------------------------------------------------] 41% est: 6s 
 plot: [6,5] [============================================>---------------------------------------------------------------] 41% est: 5s 
 plot: [6,6] [============================================>---------------------------------------------------------------] 42% est: 5s 
 plot: [6,7] [=============================================>--------------------------------------------------------------] 43% est: 5s 
 plot: [6,8] [==============================================>-------------------------------------------------------------] 43% est: 5s 
 plot: [6,9] [==============================================>-------------------------------------------------------------] 44% est: 5s 
 plot: [6,10] [==============================================>------------------------------------------------------------] 44% est: 5s 
 plot: [6,11] [===============================================>-----------------------------------------------------------] 45% est: 5s 
 plot: [6,12] [================================================>----------------------------------------------------------] 46% est: 5s 
 plot: [6,13] [================================================>----------------------------------------------------------] 46% est: 5s 
 plot: [7,1] [=================================================>----------------------------------------------------------] 47% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,2] [==================================================>---------------------------------------------------------] 47% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,3] [===================================================>--------------------------------------------------------] 48% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,4] [===================================================>--------------------------------------------------------] 49% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,5] [====================================================>-------------------------------------------------------] 49% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,6] [=====================================================>------------------------------------------------------] 50% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [7,7] [=====================================================>------------------------------------------------------] 50% est: 5s 
 plot: [7,8] [======================================================>-----------------------------------------------------] 51% est: 5s 
 plot: [7,9] [=======================================================>----------------------------------------------------] 51% est: 5s 
 plot: [7,10] [=======================================================>---------------------------------------------------] 52% est: 5s 
 plot: [7,11] [=======================================================>---------------------------------------------------] 53% est: 5s 
 plot: [7,12] [========================================================>--------------------------------------------------] 53% est: 5s 
 plot: [7,13] [=========================================================>-------------------------------------------------] 54% est: 5s 
 plot: [8,1] [==========================================================>-------------------------------------------------] 54% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,2] [==========================================================>-------------------------------------------------] 55% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,3] [===========================================================>------------------------------------------------] 56% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,4] [============================================================>-----------------------------------------------] 56% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,5] [============================================================>-----------------------------------------------] 57% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,6] [=============================================================>----------------------------------------------] 57% est: 5s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [8,7] [==============================================================>---------------------------------------------] 58% est: 5s 
 plot: [8,8] [==============================================================>---------------------------------------------] 59% est: 5s 
 plot: [8,9] [===============================================================>--------------------------------------------] 59% est: 5s 
 plot: [8,10] [===============================================================>-------------------------------------------] 60% est: 5s 
 plot: [8,11] [================================================================>------------------------------------------] 60% est: 5s 
 plot: [8,12] [================================================================>------------------------------------------] 61% est: 5s 
 plot: [8,13] [=================================================================>-----------------------------------------] 62% est: 4s 
 plot: [9,1] [==================================================================>-----------------------------------------] 62% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,2] [===================================================================>----------------------------------------] 63% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,3] [===================================================================>----------------------------------------] 63% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,4] [====================================================================>---------------------------------------] 64% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,5] [=====================================================================>--------------------------------------] 64% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,6] [=====================================================================>--------------------------------------] 65% est: 4s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [9,7] [======================================================================>-------------------------------------] 66% est: 4s 
 plot: [9,8] [=======================================================================>------------------------------------] 66% est: 4s 
 plot: [9,9] [=======================================================================>------------------------------------] 67% est: 4s 
 plot: [9,10] [=======================================================================>-----------------------------------] 67% est: 4s 
 plot: [9,11] [========================================================================>----------------------------------] 68% est: 4s 
 plot: [9,12] [========================================================================>----------------------------------] 69% est: 4s 
 plot: [9,13] [=========================================================================>---------------------------------] 69% est: 4s 
 plot: [10,1] [==========================================================================>--------------------------------] 70% est: 4s 
 plot: [10,2] [==========================================================================>--------------------------------] 70% est: 4s 
 plot: [10,3] [===========================================================================>-------------------------------] 71% est: 4s 
 plot: [10,4] [============================================================================>------------------------------] 72% est: 4s 
 plot: [10,5] [============================================================================>------------------------------] 72% est: 4s 
 plot: [10,6] [=============================================================================>-----------------------------] 73% est: 3s 
 plot: [10,7] [==============================================================================>----------------------------] 73% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,8] [==============================================================================>----------------------------] 74% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,9] [===============================================================================>---------------------------] 75% est: 3s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [10,10] [===============================================================================>--------------------------] 75% est: 3s 
 plot: [10,11] [===============================================================================>--------------------------] 76% est: 3s 
 plot: [10,12] [================================================================================>-------------------------] 76% est: 3s 
 plot: [10,13] [=================================================================================>------------------------] 77% est: 3s 
 plot: [11,1] [==================================================================================>------------------------] 78% est: 3s 
 plot: [11,2] [===================================================================================>-----------------------] 78% est: 3s 
 plot: [11,3] [===================================================================================>-----------------------] 79% est: 3s 
 plot: [11,4] [====================================================================================>----------------------] 79% est: 3s 
 plot: [11,5] [====================================================================================>----------------------] 80% est: 3s 
 plot: [11,6] [=====================================================================================>---------------------] 80% est: 2s 
 plot: [11,7] [======================================================================================>--------------------] 81% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,8] [======================================================================================>--------------------] 82% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,9] [=======================================================================================>-------------------] 82% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [11,10] [=======================================================================================>------------------] 83% est: 2s 
 plot: [11,11] [=======================================================================================>------------------] 83% est: 2s 
 plot: [11,12] [========================================================================================>-----------------] 84% est: 2s 
 plot: [11,13] [=========================================================================================>----------------] 85% est: 2s 
 plot: [12,1] [==========================================================================================>----------------] 85% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,2] [===========================================================================================>---------------] 86% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,3] [===========================================================================================>---------------] 86% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,4] [============================================================================================>--------------] 87% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,5] [=============================================================================================>-------------] 88% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,6] [=============================================================================================>-------------] 88% est: 2s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,7] [==============================================================================================>------------] 89% est: 1s 
 plot: [12,8] [===============================================================================================>-----------] 89% est: 1s 
 plot: [12,9] [===============================================================================================>-----------] 90% est: 1s 
 plot: [12,10] [===============================================================================================>----------] 91% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,11] [================================================================================================>---------] 91% est: 1s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [12,12] [================================================================================================>---------] 92% est: 1s 
 plot: [12,13] [=================================================================================================>--------] 92% est: 1s 
 plot: [13,1] [==================================================================================================>--------] 93% est: 1s 
 plot: [13,2] [===================================================================================================>-------] 93% est: 1s 
 plot: [13,3] [====================================================================================================>------] 94% est: 1s 
 plot: [13,4] [====================================================================================================>------] 95% est: 1s 
 plot: [13,5] [=====================================================================================================>-----] 95% est: 1s 
 plot: [13,6] [======================================================================================================>----] 96% est: 1s 
 plot: [13,7] [======================================================================================================>----] 96% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,8] [=======================================================================================================>---] 97% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,9] [=======================================================================================================>---] 98% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,10] [=======================================================================================================>--] 98% est: 0s 
 plot: [13,11] [========================================================================================================>-] 99% est: 0s 
 plot: [13,12] [========================================================================================================>-] 99% est: 0s `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

 plot: [13,13] [==========================================================================================================]100% est: 0s 
                                                                                                                                        

  • yr_built
  • waterfront
  • condition
  • view
mod4a1 <- lm(ln_price ~ sqft_living + lat + grade + yr_built,
             data = house)

autoplot(mod4a1)
Warning: Removed 2919 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

summary(mod4a1)

Call:
lm(formula = ln_price ~ sqft_living + lat + grade + yr_built, 
    data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.82744 -0.17028 -0.00154  0.16590  1.27592 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -4.269e+01  7.053e-01 -60.527   <2e-16 ***
sqft_living  2.343e-04  3.178e-06  73.718   <2e-16 ***
lat          1.315e+00  1.380e-02  95.327   <2e-16 ***
grade.L      1.688e+00  1.453e-01  11.616   <2e-16 ***
grade.Q      4.864e-02  1.460e-01   0.333   0.7390    
grade.C     -2.733e-01  1.307e-01  -2.091   0.0365 *  
grade^4     -1.403e-01  1.160e-01  -1.210   0.2265    
grade^5      1.620e-01  1.034e-01   1.567   0.1172    
grade^6     -1.666e-01  8.764e-02  -1.901   0.0573 .  
grade^7      3.879e-02  6.779e-02   0.572   0.5672    
grade^8     -4.769e-02  4.704e-02  -1.014   0.3107    
grade^9      1.368e-02  2.898e-02   0.472   0.6369    
grade^10    -6.882e-03  1.552e-02  -0.444   0.6574    
grade^11     6.962e-03  6.815e-03   1.022   0.3070    
yr_built    -3.710e-03  7.392e-05 -50.193   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2711 on 21598 degrees of freedom
Multiple R-squared:  0.7353,    Adjusted R-squared:  0.7351 
F-statistic:  4285 on 14 and 21598 DF,  p-value: < 2.2e-16
mod4b1 <- lm(ln_price ~ sqft_living + lat + grade + waterfront,
             data = house)

autoplot(mod4b1)
Warning: Removed 2332 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

summary(mod4b1)

Call:
lm(formula = ln_price ~ sqft_living + lat + grade + waterfront, 
    data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.76309 -0.18007 -0.01341  0.16778  1.34215 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)    -5.807e+01  6.613e-01 -87.821   <2e-16 ***
sqft_living     2.321e-04  3.292e-06  70.500   <2e-16 ***
lat             1.485e+00  1.389e-02 106.962   <2e-16 ***
grade.L         1.414e+00  1.502e-01   9.410   <2e-16 ***
grade.Q         3.597e-02  1.511e-01   0.238   0.8118    
grade.C        -8.623e-02  1.352e-01  -0.638   0.5235    
grade^4        -1.381e-01  1.200e-01  -1.151   0.2499    
grade^5         1.983e-01  1.070e-01   1.853   0.0639 .  
grade^6        -1.274e-01  9.068e-02  -1.405   0.1600    
grade^7         8.760e-02  7.013e-02   1.249   0.2117    
grade^8        -5.796e-02  4.867e-02  -1.191   0.2337    
grade^9         1.609e-02  2.999e-02   0.537   0.5915    
grade^10       -5.348e-04  1.606e-02  -0.033   0.9734    
grade^11        4.405e-03  7.050e-03   0.625   0.5321    
waterfrontTRUE  6.790e-01  2.226e-02  30.508   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2805 on 21598 degrees of freedom
Multiple R-squared:  0.7166,    Adjusted R-squared:  0.7164 
F-statistic:  3901 on 14 and 21598 DF,  p-value: < 2.2e-16
mod4c1 <- lm(ln_price ~ sqft_living + lat + grade + condition,
             data = house)

autoplot(mod4c1)
Warning: Removed 2437 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

summary(mod4c1)

Call:
lm(formula = ln_price ~ sqft_living + lat + grade + condition, 
    data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.78842 -0.18177 -0.01093  0.16237  1.28900 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -5.752e+01  6.588e-01 -87.307  < 2e-16 ***
sqft_living  2.277e-04  3.282e-06  69.379  < 2e-16 ***
lat          1.474e+00  1.383e-02 106.585  < 2e-16 ***
grade.L      1.470e+00  1.516e-01   9.697  < 2e-16 ***
grade.Q      1.293e-01  1.525e-01   0.848    0.397    
grade.C     -1.595e-01  1.364e-01  -1.169    0.242    
grade^4     -1.486e-01  1.208e-01  -1.230    0.219    
grade^5      1.478e-01  1.074e-01   1.377    0.169    
grade^6     -1.278e-01  9.074e-02  -1.409    0.159    
grade^7      4.612e-02  7.000e-02   0.659    0.510    
grade^8     -4.994e-02  4.849e-02  -1.030    0.303    
grade^9      6.145e-03  2.984e-02   0.206    0.837    
grade^10     1.857e-03  1.597e-02   0.116    0.907    
grade^11     1.109e-03  7.015e-03   0.158    0.874    
condition.L  2.292e-01  3.403e-02   6.735 1.69e-11 ***
condition.Q  6.787e-02  2.870e-02   2.365    0.018 *  
condition.C -2.920e-02  2.147e-02  -1.360    0.174    
condition^4  4.729e-03  1.224e-02   0.386    0.699    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.279 on 21595 degrees of freedom
Multiple R-squared:  0.7196,    Adjusted R-squared:  0.7194 
F-statistic:  3260 on 17 and 21595 DF,  p-value: < 2.2e-16
mod4d1 <- lm(ln_price ~ sqft_living + lat + grade + view,
             data = house)

autoplot(mod4d1)
Warning: Removed 2743 row(s) containing missing values (geom_path).
Warning: Removed 1 rows containing missing values (geom_point).
Warning: Removed 1 row(s) containing missing values (geom_path).

summary(mod4d1)

Call:
lm(formula = ln_price ~ sqft_living + lat + grade + view, data = house)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.05330 -0.17372 -0.01064  0.16413  1.16842 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -5.767e+01  6.485e-01 -88.919  < 2e-16 ***
sqft_living  2.189e-04  3.253e-06  67.294  < 2e-16 ***
lat          1.481e+00  1.362e-02 108.786  < 2e-16 ***
grade.L      1.346e+00  1.473e-01   9.138  < 2e-16 ***
grade.Q     -2.585e-02  1.481e-01  -0.175  0.86147    
grade.C     -1.219e-01  1.325e-01  -0.920  0.35754    
grade^4     -1.478e-01  1.176e-01  -1.256  0.20902    
grade^5      1.796e-01  1.049e-01   1.712  0.08691 .  
grade^6     -1.440e-01  8.891e-02  -1.620  0.10525    
grade^7      9.201e-02  6.876e-02   1.338  0.18088    
grade^8     -6.985e-02  4.772e-02  -1.464  0.14327    
grade^9      1.997e-02  2.940e-02   0.679  0.49708    
grade^10    -7.697e-03  1.574e-02  -0.489  0.62493    
grade^11     6.455e-03  6.913e-03   0.934  0.35041    
view.L       3.256e-01  1.184e-02  27.491  < 2e-16 ***
view.Q       3.219e-02  1.090e-02   2.952  0.00316 ** 
view.C       1.357e-01  1.322e-02  10.260  < 2e-16 ***
view^4      -4.492e-02  1.140e-02  -3.940 8.17e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.275 on 21595 degrees of freedom
Multiple R-squared:  0.7276,    Adjusted R-squared:  0.7274 
F-statistic:  3393 on 17 and 21595 DF,  p-value: < 2.2e-16
LS0tCnRpdGxlOiAiUiBOb3RlYm9vayIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKYGBge3J9CmxpYnJhcnkodGlkeXZlcnNlKQpsaWJyYXJ5KGNhcikKbGlicmFyeShtb2RlbHIpCmxpYnJhcnkoc2tpbXIpCmxpYnJhcnkoR0dhbGx5KQpsaWJyYXJ5KGdnZm9ydGlmeSkKYGBgCgoKIyBRdWVzdGlvbiAxIAoKIyMjIFRpZHkgdXAgdGhlIGRhdGEgcmVhZHkgZm9yIHJlZ3Jlc3Npb246CgoKYGBge3J9Cmh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